[Issue 6473] Stack overflow with struct destructor as default parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 19 02:11:15 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6473


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug at yahoo.com.au
            Version|D1 & D2                     |D2
            Summary|segfault in Lexer::uniqueId |Stack overflow with struct
                   |                            |destructor as default
                   |                            |parameter


--- Comment #1 from Don <clugdbug at yahoo.com.au> 2011-09-19 02:10:40 PDT ---
It's not a segfault, and it has nothing to do with Lexer::uniqueId.
It's a stack overflow. It's also D2-only, because it requires a struct
destructor.

StructLiteralExp::semantic() sees that Eins has a destructor, so it rewrites it
as
Eins devices = (Eins tmp = Eins(), tmp);
Then, it runs semantic on the comma expression it created.
VarDeclaration::semantic on tmp calls StructLiteralExp::semantic, which again
sees Eins has destructor, so it does an another rewrite.
Eins devices = (Eins tmp = (Eins tmp2 = Eins(), tmp2), tmp);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list