Bug 3101 – Stack overflow: declaring aggregate member twice with static if

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
Other
OS
All
Creation time
2009-06-28T18:23:00Z
Last change time
2014-04-18T09:12:04Z
Keywords
ice-on-invalid-code, patch
Assigned to
nobody
Creator
jason.james.house

Attachments

IDFilenameSummaryContent-TypeSize
407main.dfile demonstrating issuetext/x-dsrc231

Comments

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);
Comment #4 by bugzilla — 2009-10-13T13:45:47Z
Fixed dmd 1.049 and 2.034