Skip to content

Commit

Permalink
fix Issue 8763 - struct initialization with empty variadic arguments …
Browse files Browse the repository at this point in the history
…tries to call constructor
  • Loading branch information
9rnsr committed Feb 9, 2013
1 parent 86d758c commit 92cd2d1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/expression.c
Original file line number Diff line number Diff line change
Expand Up @@ -7829,6 +7829,9 @@ Expression *CallExp::semantic(Scope *sc)
if (e1->type)
t1 = e1->type->toBasetype();

arguments = arrayExpressionSemantic(arguments, sc);
preFunctionParameters(loc, sc, arguments);

// Check for call operator overload
if (t1)
{ AggregateDeclaration *ad;
Expand Down Expand Up @@ -7916,9 +7919,6 @@ Expression *CallExp::semantic(Scope *sc)
}
}

arguments = arrayExpressionSemantic(arguments, sc);
preFunctionParameters(loc, sc, arguments);

// If there was an error processing any argument, or the call,
// return an error without trying to resolve the function call.
if (arguments && arguments->dim)
Expand Down
21 changes: 21 additions & 0 deletions test/runnable/structlit.d
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,26 @@ void test7021()
})));
}

/********************************************/
// 8763

void test8763()
{
struct S
{
this(int) {}
}

void foo(T, Args...)(Args args)
{
T t = T(args);
// Error: constructor main.S.this (int) is not callable using argument types ()
}

S t = S(); // OK, initialize to S.init
foo!S();
}

/********************************************/
// 9116

Expand Down Expand Up @@ -638,6 +658,7 @@ int main()
test6937();
test7929();
test7021();
test8763();
test9116();
test9293();

Expand Down

0 comments on commit 92cd2d1

Please sign in to comment.