Comment #0 by jason.james.house — 2009-06-28T18:23:56Z
The attached code demonstrates the issue. Below is the compilation command used to reproduce the bug (and the output from dmd before it hung)
dmd -gc -O -release main.d -ofmain
error: foo is not shared (1)
main.d(4): Error: declaration T is already defined
Comment #1 by jason.james.house — 2009-06-28T18:28:35Z
Created attachment 407
file demonstrating issue
Comment #2 by clugdbug — 2009-07-09T04:56:58Z
Reduced test case (Windows):
---
struct foo{
static if (is(int T == int)) {}
static if (is(int T == int)) {}
}
----
> dmd ice.d
ice.d(3): Error: declaration T is already defined
Stack overflow
On DMD1, it stack overflows without error message.
Comment #3 by clugdbug — 2009-08-12T11:26:48Z
Patch is very easy.
in int AliasDeclaration::overloadInsert(Dsymbol *s), make sure it doesn't call itself.
Index: declaration.c
===================================================================
--- declaration.c (revision 194)
+++ declaration.c (working copy)
@@ -543,6 +543,8 @@
{ overnext = s;
return TRUE;
}
+ else if (overnext==this) // a recursive expansion would ensue. Bugzilla 3101
+ return FALSE;
else
{
return overnext->overloadInsert(s);