[Issue 3326] $ in delegate literal causes Access Violation
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Aug 6 00:11:03 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3326
Don <clugdbug at yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
Version|D2 |D1 & D2
Summary|Regression(2.010): $ in |$ in delegate literal
|delegate literal causes |causes Access Violation
|Access Violation |
Severity|regression |major
--- Comment #2 from Don <clugdbug at yahoo.com.au> 2010-08-06 00:11:01 PDT ---
This isn't a regression, it never worked properly (on D1, it doesn't segfault,
but the generated code is wrong).
It's happening because __dollar isn't a real variable in the parent scope. I
think to fix this properly, either the implementation of __dollar would need to
change, OR the delegate literal would need to be inlined; but this case is so
obscure, it doesn't matter much.
To turn this from wrong-code into a rather obscure rejects-valid:
declaration.c, VarDeclaration::checkNestedReference(), line 1441 (D2 svn 599):
fdv->closureVars.push(this);
L2: ;
+ // __dollar creates problems because it isn't a real variable
+ if (ident == Id::dollar)
+ ::error(loc, "cannnot use $ inside a function literal
(Bugzilla 3326)");
--
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