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
Created attachment 407 [details] file demonstrating issue
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.
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);
Fixed dmd 1.049 and 2.034