[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 09:04:18 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2935
--- Comment #8 from Walter Bright <bugzilla at digitalmars.com> 2010-04-27 09:04:17 PDT ---
The problem is the code here in expression.c funcParameters():
arg = p->defaultArg;
arg = arg->copy(); <-- Danger, Will Robinson!
arg = arg->resolveLoc(loc, sc);
arguments->push(arg);
The arg->copy() is the problem, as it will copy any DeclarationExp's resulting
in multiple declarations with the same name. A correct fix will be to do what
DeclarationExp::doInline() does, which is for any non-static declarations,
create another declaration.
A new expression tree walker has to be built to accomplish this. Perhaps a good
approach is to create a generic walker that accepts a lambda function to
operate on each node.
--
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