[Issue 380] New: cannot use typeof(*this) in a static context

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 27 10:21:59 PDT 2006


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

           Summary: cannot use typeof(*this) in a static context
           Product: D
           Version: 0.167
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: minor
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: h3r3tic at mat.uni.torun.pl


struct Foo {
        alias typeof(*this) ThisType;
}


> 'this' is only allowed in non-static member functions
> can only * a pointer, not a 'int'



workaround:

struct Foo {
        alias typeof(*typeof(this).init) ThisType;
        static assert (is(Foo == ThisType));
}


-- 




More information about the Digitalmars-d-bugs mailing list