August 10, 2005 offsetof doesn't work on method-local struct members | ||||
---|---|---|---|---|
| ||||
class Foo { void Bar() { struct tmpStruct { int blah; }; static assert(tmpStruct.blah.offsetof==0); } } ------ > dmd test.d test.d(7): this for blah needs to be type tmpStruct not type test.Foo test.d(7): class test.Foo member blah is not accessible ------ Using other properties (like sizeof) seems to work, as it works when the function is not within a class. It has nothing to do with static assert, as writefln()ing the offsetof also doesn't work.. DMD 0.129 on WinXP. xs0 |
August 13, 2005 Re: offsetof doesn't work on method-local struct members | ||||
---|---|---|---|---|
| ||||
Posted in reply to xs0 Attachments: | xs0 schrieb: > class Foo { > void Bar() > { > struct tmpStruct { > int blah; > }; > static assert(tmpStruct.blah.offsetof==0); > } > } > > ------ > >> dmd test.d > test.d(7): this for blah needs to be type tmpStruct not type test.Foo > test.d(7): class test.Foo member blah is not accessible > > ------ > > Using other properties (like sizeof) seems to work, as it works when the > function is not within a class. It has nothing to do with static assert, > as writefln()ing the offsetof also doesn't work.. > > DMD 0.129 on WinXP. Added to DStress as http://dstress.kuehne.cn/run/o/offsetof_80_A.d http://dstress.kuehne.cn/run/o/offsetof_80_B.d http://dstress.kuehne.cn/run/o/offsetof_80_C.d http://dstress.kuehne.cn/run/o/offsetof_80_D.d http://dstress.kuehne.cn/run/o/offsetof_80_E.d http://dstress.kuehne.cn/run/o/offsetof_80_F.d Thomas |
Copyright © 1999-2021 by the D Language Foundation