digitalmars.D.bugs - [Issue 1369] New: Unable to find 'this' in __traits(getMember)
- d-bugmail puremagic.com Jul 24 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 digitalmars.com ReportedBy: reiner.pope 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"))(); --
Jul 24 2007








d-bugmail puremagic.com