Skip to content

Commit

Permalink
fix Issue 9284 - DMD segfaults with templated ctors in constructor de…
Browse files Browse the repository at this point in the history
…legation
  • Loading branch information
9rnsr committed Jan 9, 2013
1 parent dc3c55e commit 1c8305d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/expression.c
Expand Up @@ -8334,6 +8334,8 @@ Expression *CallExp::semantic(Scope *sc)
}

f = resolveFuncCall(sc, loc, cd->ctor, NULL, NULL, arguments, 0);
if (!f)
return new ErrorExp();
checkDeprecated(sc, f);
#if DMDV2
checkPurity(sc, f);
Expand Down
22 changes: 22 additions & 0 deletions test/fail_compilation/ice9284.d
@@ -0,0 +1,22 @@
/*
TEST_OUTPUT:
---
fail_compilation/ice9284.d(15): Error: template ice9284.C.__ctor does not match any function template declaration. Candidates are:
fail_compilation/ice9284.d(13): ice9284.C.__ctor()(string)
fail_compilation/ice9284.d(15): Error: template ice9284.C.__ctor()(string) cannot deduce template function from argument types !()(int)
fail_compilation/ice9284.d(21): Error: template instance ice9284.C.__ctor!() error instantiating
---
*/

class C
{
this()(string)
{
this(10);
// delegating to a constructor which not exists.
}
}
void main()
{
new C("hello");
}

0 comments on commit 1c8305d

Please sign in to comment.