www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1369] New: Unable to find 'this' in __traits(getMember)


           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")();



Jul 24 2007