[Issue 9041] New: "Need 'this' to access member" of inner class in typeid

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 17 12:49:43 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=9041

           Summary: "Need 'this' to access member" of inner class in
                    typeid
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: freeslave93 at gmail.com


--- Comment #0 from Roman <freeslave93 at gmail.com> 2012-11-17 12:49:41 PST ---
The following code generates error "need 'this' to access member b"

import std.stdio;

class B
{

}

class A
{
    B b;
}

int main(string[] args)
{
    static assert(is(typeof( {A a = new A; writeln(typeid(a.b));}))); //pass

    //same but out of static assert
    A a = new A;
    writeln(typeid(a.b)); //error
    return 0;
}

But it's ok if we replace class B with struct.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list