Bug 1684 – offsetof does not work, adding cast is workaround
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2007-11-22T03:02:00Z
Last change time
2015-06-09T05:11:38Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
benoit
Comments
Comment #0 by benoit — 2007-11-22T03:02:55Z
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'
}