Bug 8691 – Stack overflow with recursive struct

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2012-09-18T20:07:00Z
Last change time
2012-10-06T03:48:43Z
Keywords
diagnostic
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2012-09-18T20:07:01Z
struct Foo { Foo[1] foos; } void main() {} DMD 2.061alpha shows: Stack overflow
Comment #1 by andrej.mitrovich — 2012-10-04T17:49:56Z
I can fix this but I need a little help with the error implementation. After adding a check I end up with: mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type Anyone savvy enough with DMD knows how to avoid spawning so much errors?
Comment #2 by andrej.mitrovich — 2012-10-04T17:53:57Z
(In reply to comment #1) > I can fix this but I need a little help with the error implementation. After > adding a check I end up with: Ok I think I've got it, making pull shortly..
Comment #3 by bearophile_hugs — 2012-10-06T03:48:43Z