[Issue 515] New: Spec incorrect in where .offsetof can be applied

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 15 05:02:03 PST 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 at digitalmars.com
        ReportedBy: deewiant at 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.


-- 




More information about the Digitalmars-d-bugs mailing list