[Issue 2323] ICE(cgcs.c): taking address of a method of a temporary struct
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed May 27 05:43:59 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2323
Don <clugdbug at yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch, wrong-code
Version|2.018 |1.040
--- Comment #1 from Don <clugdbug at yahoo.com.au> 2009-05-27 05:43:58 PDT ---
This bug also applies to D1. And it silently generates bad code if compiled
with -O. Reduced test case:
----
struct A {
void foo() {}
}
A bar() {A a; return a;}
void main() {
void delegate() x = &bar().foo;
}
---
Root cause: should not be able to make a delegate from something which isn't an
lvalue (just as you can't take address of a function return).
PATCH: add one line in expression.c, DelegateExp::semantic(Scope *sc)
if (func->needThis())
e1 = getRightThis(loc, sc, ad, e1, func);
+ e1->toLvalue(sc, e1); // add this line
}
--
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