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' }
Comment #1 by k.hara.pg — 2011-07-14T04:32:38Z
Comment #2 by k.hara.pg — 2011-07-14T04:34:51Z
This problem occurs also in D2.
Comment #3 by bugzilla — 2011-08-11T13:33:11Z