Bug 6173 – Compiler treats read access of a delegate's function pointer as an lvalue access

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2011-06-17T18:39:00Z
Last change time
2011-06-17T20:57:22Z
Assigned to
nobody
Creator
schveiguy

Comments

Comment #0 by schveiguy — 2011-06-17T18:39:40Z
The following code: struct S { void foo(); } void main() { S s; auto fptr = (&s.foo).funcptr; } Generates the following error: testdelegatefuncptr.d(9): Error: &s.foo is not an lvalue But clearly, I'm not using &s.foo as an lvalue.
Comment #1 by yebblies — 2011-06-17T20:57:22Z
This is because dg.funcptr is re-written as *(&dg+4), it's on my list. *** This issue has been marked as a duplicate of issue 2472 ***