[Issue 1369] New: Unable to find 'this' in __traits(getMember)
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jul 24 04:33:49 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1369
Summary: Unable to find 'this' in __traits(getMember)
Product: D
Version: unspecified
Platform: PC
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: reiner.pope at gmail.com
the following code fails to compile.
class Foo
{
Bar impl;
void foo()
{
__traits(getMember, impl, "func")(); // line 7
}
}
class Bar { void func() { } }
---
The error occurs on line 7: "need 'this' to access member impl"
The code compiles if you replace line 7 with
__traits(getMember, this.impl, "func")();
or
(mixin("impl.func"))();
--
More information about the Digitalmars-d-bugs
mailing list