Thread overview
[Issue 1684] New: offsetof does not work, adding cast is workaround
Nov 22, 2007
d-bugmail
Jul 14, 2011
Kenji Hara
Jul 14, 2011
Kenji Hara
Aug 11, 2011
Walter Bright
November 22, 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@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'
}


-- 

July 14, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=1684


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |k.hara.pg@gmail.com


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2011-07-14 04:32:38 PDT ---
https://github.com/D-Programming-Language/dmd/pull/230

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 14, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=1684


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|1.023                       |D1 & D2


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2011-07-14 04:34:51 PDT ---
This problem occurs also in D2.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 11, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=1684


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2011-08-11 13:33:11 PDT ---
https://github.com/D-Programming-Language/dmd/commit/031f1694a5dd10b0b65bd77ef7bb9965e2e027d3

https://github.com/D-Programming-Language/dmd/commit/d49cb8906c2e3b39bcf0ac2e6b36ed13510cc432

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------