www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 979] New: offsetof for classes does not work

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=979

           Summary: offsetof for classes does not work
           Product: D
           Version: 1.005
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: benoit tionex.de


from: http://www.digitalmars.com/d/class.html
the example
class Foo
{
    int x;
}
void test(Foo foo)
{
    size_t o;

    o = Foo.x.offsetof;   // yields 8
}


t.d(12): Error: 'this' is only allowed in non-static member functions, not test
t.d(12): Error: this for x needs to be type Foo not type int


-- 
Feb 17 2007
next sibling parent Tom <tom nospam.com> writes:
Hey Frank,

   don't you think that maybe in this one, severity could be marked as 
something higher than normal?

Kind regards,
--
Tom;

d-bugmail puremagic.com escribió:
 http://d.puremagic.com/issues/show_bug.cgi?id=979
 
            Summary: offsetof for classes does not work
            Product: D
            Version: 1.005
           Platform: PC
         OS/Version: Linux
             Status: NEW
           Severity: normal
           Priority: P2
          Component: DMD
         AssignedTo: bugzilla digitalmars.com
         ReportedBy: benoit tionex.de
 
 
 from: http://www.digitalmars.com/d/class.html
 the example
 class Foo
 {
     int x;
 }
 void test(Foo foo)
 {
     size_t o;
 
     o = Foo.x.offsetof;   // yields 8
 }
 
 
 t.d(12): Error: 'this' is only allowed in non-static member functions, not test
 t.d(12): Error: this for x needs to be type Foo not type int
 
 
Feb 18 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=979


benoit tionex.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major





    don't you think that maybe in this one, severity could be marked as 
 something higher than normal?
Yes, i forgot about setting this. --
Feb 19 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=979






But note, this works:
class Foo{
  int x;
  static void foo(){
    int o = x.offsetof; // works
  }
}


-- 
Feb 19 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=979






Added to DStress as:
http://dstress.kuehne.cn/run/offsetof_78_B.d
http://dstress.kuehne.cn/run/offsetof_78_C.d


-- 
Mar 08 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=979


thomas-dloop kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|Linux                       |All





fixed URLs:
http://dstress.kuehne.cn/run/o/offsetof_78_B.d
http://dstress.kuehne.cn/run/o/offsetof_78_C.d


-- 
Apr 27 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=979


onlystupidspamhere yahoo.se changed:

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






is older and the description is a bit more precise.

*** This bug has been marked as a duplicate of 515 ***


-- 
Jun 17 2007