Permalink
Browse files

fix Issue 9406 - (Regression: 2.061) Stack overflow from a forward re…

…ference error
  • Loading branch information...
1 parent d37a401 commit fb0aca7d5c7d103ea545574101355282edeba90b @9rnsr 9rnsr committed Jan 29, 2013
Showing with 28 additions and 3 deletions.
  1. +5 −3 src/template.c
  2. +23 −0 test/fail_compilation/ice9406.d
View
@@ -2432,9 +2432,11 @@ char *TemplateDeclaration::toChars()
}
buf.writeByte(')');
- if (onemember && onemember->toAlias())
- {
- FuncDeclaration *fd = onemember->toAlias()->isFuncDeclaration();
+ if (onemember)
+ { /* Bugzilla 9406:
+ * onemember->toAlias() might run semantic, so should not call it in stringizing
+ */
+ FuncDeclaration *fd = onemember->isFuncDeclaration();
if (fd && fd->type)
{
TypeFunction *tf = (TypeFunction *)fd->type;
@@ -0,0 +1,23 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/ice9406.d(15): Error: mixin ice9406.S.t1().Mixin!() cannot resolve forward reference
+fail_compilation/ice9406.d(22): Error: expression has no value
+---
+*/
+
+mixin template Mixin() { }
+
+struct S
+{
+ template t1()
+ {
+ mixin Mixin t1;
+ }
+}
+
+void main()
+{
+ S s1;
+ s1.t1!();
+}

0 comments on commit fb0aca7

Please sign in to comment.