Thread overview
[Issue 515] New: Spec incorrect in where .offsetof can be applied
Nov 15, 2006
d-bugmail
Dec 12, 2006
d-bugmail
Jun 17, 2007
d-bugmail
Jun 17, 2007
d-bugmail
Jul 02, 2008
d-bugmail
Jul 08, 2008
d-bugmail
Jul 09, 2008
d-bugmail
Jul 10, 2008
d-bugmail
November 15, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=515

           Summary: Spec incorrect in where .offsetof can be applied
           Product: D
           Version: 0.174
          Platform: PC
               URL: http://www.digitalmars.com/d/class.html
        OS/Version: Windows
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P4
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: deewiant@gmail.com
OtherBugsDependingO 511
             nThis:


The spec has code amounting to the following, under "Field Properties":

class Foo {
    int x;
}

void main() {
        Foo foo = new Foo();

        size_t o;
        o = Foo.x.offsetof;
        o = foo.x.offsetof;
}

The spec states that the above of the two assignments to o should yield 8 and the below should fail to compile. DMD's behaviour is precisely the opposite. The explanation confused me somewhere around "fields qualified with the type of the class" so I'm not sure which is right, but one of the two - the spec, or DMD - has to be wrong.


-- 

December 12, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=515


smjg@iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg@iname.com
           Keywords|                            |accepts-invalid, rejects-
                   |                            |valid




------- Comment #1 from smjg@iname.com  2006-12-11 20:23 -------
The spec makes more sense than what the compiler is doing.  I'm therefore inclined that DMD is wrong.


-- 

June 17, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=515


onlystupidspamhere@yahoo.se changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |benoit@tionex.de




------- Comment #2 from onlystupidspamhere@yahoo.se  2007-06-17 15:52 -------
*** Bug 979 has been marked as a duplicate of this bug. ***


-- 

June 17, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=515


onlystupidspamhere@yahoo.se changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major
         OS/Version|Windows                     |All
           Priority|P4                          |P2




------- Comment #3 from onlystupidspamhere@yahoo.se  2007-06-17 15:54 -------
Updated the severity etc. from #979.


-- 

July 02, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=515





------- Comment #4 from wbaxter@gmail.com  2008-07-02 03:52 -------
Just a ping that the spec (http://www.digitalmars.com/d/1.0/class.html) is
still not in line with the compiler (DMD 1.031).
You can see it first mentioned regarding DMD 0.131 back in 2005 here:
http://www.digitalmars.com/d/archives/digitalmars/D/bugs/4988.html

Just to recap:
In the compiler
  Foo.init.x.offsetof works.
  Foo.x.offsetof does not.
Spec says the opposite is true.


-- 

July 08, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=515


davidl@126.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |samukha@voliacable.com




------- Comment #5 from davidl@126.com  2008-07-08 06:01 -------
*** Bug 2202 has been marked as a duplicate of this bug. ***


-- 

July 09, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=515


wbaxter@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #6 from wbaxter@gmail.com  2008-07-09 06:44 -------
There's a typo in the updated doc now:
".offsetof can only be applied to not expressions"

I'll file a different bug though.  This basic issue of this bug has been fixed by changing the spec.


-- 

July 10, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=515





------- Comment #7 from bugzilla@digitalmars.com  2008-07-09 22:33 -------
Fixed dmd 1.032 and 2.016


--