[Issue 2323] New: Internal error: taking address of a method of a temporary struct
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Aug 30 09:48:45 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2323
Summary: Internal error: taking address of a method of a
temporary struct
Product: D
Version: 2.018
Platform: PC
OS/Version: Windows
Status: NEW
Keywords: ice-on-valid-code
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: snake.scaly at gmail.com
Compiler reports an internal error if an address of a temporary struct's method
is taken:
---- begin test.d
void main()
{
struct A {
void foo() {}
static A opCall() {A a; return a;}
}
void delegate() x = &A().foo;
}
---- end test.d
>dmd test.d
Internal error: ..\ztc\cgcs.c 358
Workaround is to use an explicit stack variable for A():
auto y = A();
void delegate() x = &y.foo;
compiles and works correctly.
--
More information about the Digitalmars-d-bugs
mailing list