Browse files

fix Issue 9284 - DMD segfaults with templated ctors in constructor de…

…legation
  • Loading branch information...
1 parent dc3c55e commit 1c8305dbf70dafb1528b73c317108fb2901eb604 @9rnsr 9rnsr committed Jan 9, 2013
Showing with 24 additions and 0 deletions.
  1. +2 −0 src/expression.c
  2. +22 −0 test/fail_compilation/ice9284.d
View
2 src/expression.c
@@ -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);
View
22 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.