[Issue 1684] New: offsetof does not work, adding cast is workaround

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 22 01:02:56 PST 2007


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

           Summary: offsetof does not work, adding cast is workaround
           Product: D
           Version: 1.023
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: benoit at tionex.de


Sometime .offsetof does not compile.
Adding a cast can make it compile

template Test( uint memberOffset ){}

class MyClass {
    int flags2;
    mixin Test!(cast(uint)flags2.offsetof) t1; // compiles ok
    mixin Test!(cast(int)flags2.offsetof)  t2; // compiles ok
    mixin Test!(flags2.offsetof)           t3; // Error: no property 'offsetof'
for type 'int'
}


-- 



More information about the Digitalmars-d-bugs mailing list