www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - offsetof doesn't work on method-local struct members

reply xs0 <xs0 xs0.com> writes:
class Foo {
	void Bar()
	{
		struct tmpStruct {
			int blah;
		};
		static assert(tmpStruct.blah.offsetof==0);
	}
}

------

 dmd test.d

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
Aug 10 2005
parent =?ISO-8859-1?Q?Thomas_K=FChne?= <thomas-dloop kuehne.THISISSPAM.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

xs0 schrieb:
 class Foo {
     void Bar()
     {
         struct tmpStruct {
             int blah;
         };
         static assert(tmpStruct.blah.offsetof==0);
     }
 }
 
 ------
 
 dmd test.d

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 -----BEGIN PGP SIGNATURE----- iD8DBQFC/ltj3w+/yD4P9tIRAkohAJwJKP8Yitl15h+D8ELiPgHkYStODwCeOEu8 qC5YeWllx8ndChrIZdTylfc= =FDeT -----END PGP SIGNATURE-----
Aug 13 2005