mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 05:00:16 +03:00
Fix Bugzilla Issue 24560 - dmd crash on imported function with default parameter containing new
This commit is contained in:
parent
0e6f8c1b9a
commit
ee4f5a04ff
2 changed files with 27 additions and 0 deletions
|
@ -15286,6 +15286,9 @@ Expression resolveLoc(Expression exp, const ref Loc loc, Scope* sc)
|
|||
|
||||
Expression visitStructLiteral(StructLiteralExp exp)
|
||||
{
|
||||
if (!exp.elements)
|
||||
return exp;
|
||||
|
||||
foreach (ref element; *exp.elements)
|
||||
{
|
||||
if (element)
|
||||
|
@ -15304,6 +15307,9 @@ Expression resolveLoc(Expression exp, const ref Loc loc, Scope* sc)
|
|||
if (exp.lowering)
|
||||
exp.lowering = exp.lowering.resolveLoc(loc, sc);
|
||||
|
||||
if (!exp.arguments)
|
||||
return exp;
|
||||
|
||||
foreach (ref element; *exp.arguments)
|
||||
{
|
||||
if (element)
|
||||
|
@ -15315,6 +15321,9 @@ Expression resolveLoc(Expression exp, const ref Loc loc, Scope* sc)
|
|||
|
||||
Expression visitCall(CallExp exp)
|
||||
{
|
||||
if (!exp.arguments)
|
||||
return exp;
|
||||
|
||||
foreach (ref element; *exp.arguments)
|
||||
{
|
||||
if (element)
|
||||
|
@ -15328,6 +15337,9 @@ Expression resolveLoc(Expression exp, const ref Loc loc, Scope* sc)
|
|||
{
|
||||
exp.e1 = exp.e1.resolveLoc(loc, sc);
|
||||
|
||||
if (!exp.arguments)
|
||||
return exp;
|
||||
|
||||
foreach (ref element; *exp.arguments)
|
||||
{
|
||||
if (element)
|
||||
|
@ -15361,6 +15373,9 @@ Expression resolveLoc(Expression exp, const ref Loc loc, Scope* sc)
|
|||
if (exp.basis)
|
||||
exp.basis = exp.basis.resolveLoc(loc, sc);
|
||||
|
||||
if (!exp.elements)
|
||||
return exp;
|
||||
|
||||
foreach (ref element; *exp.elements)
|
||||
{
|
||||
if (element)
|
||||
|
|
12
compiler/test/compilable/test24560.d
Normal file
12
compiler/test/compilable/test24560.d
Normal file
|
@ -0,0 +1,12 @@
|
|||
// https://issues.dlang.org/show_bug.cgi?id=24560
|
||||
|
||||
class C { }
|
||||
struct S
|
||||
{
|
||||
static void fun(C heur = new C) { }
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
S.fun();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue