www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1684] New: offsetof does not work, adding cast is workaround

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 digitalmars.com
        ReportedBy: benoit 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'
}


-- 
Nov 22 2007