[Issue 2935] ICE(out.c) using struct with constructor as function default argument

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 27 08:49:57 PDT 2010


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


Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com


--- Comment #7 from Walter Bright <bugzilla at digitalmars.com> 2010-04-27 08:49:55 PDT ---
The problem is a semantic one. Default arguments are evaluated in the context
of the function declaration, not where it's used. So, the temporary generated
by the constructor is created in global space!

The patch tries to force it back into the function scope, but that doesn't work
as you can see if you change foo() to:

  void foo() { bar(); bar(); }

as it fails trying to allocate the same symbol twice. Not sure what the correct
solution is at the moment.

-- 
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