www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - struct.field.offsetof doesn't work for some types

reply derick_eddington nospam.yahoo.nospam.com writes:
With Linux dmd v0.114 when I try to compile:

struct S
{
uint ui;
void function() func;
long l;
void[] va;
byte b;
void* vp;
short[] delegate(Object) dg;
char c;
}

size_t o_ui =   S.ui.offsetof;
size_t o_func = S.func.offsetof;  // error
size_t o_l =    S.l.offsetof;
size_t o_va =   S.va.offsetof;
size_t o_b =    S.b.offsetof;
size_t o_vp =   S.vp.offsetof;    // error
size_t o_dg =   S.dg.offsetof;
size_t o_c =    S.c.offsetof;


I get:

$ dmd -c offsetof.d
offsetof.d(14): no property 'offsetof' for type 'void()'
offsetof.d(18): no property 'offsetof' for type 'void'
Mar 05 2005
parent =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

derick_eddington nospam.yahoo.nospam.com wrote:

| With Linux dmd v0.114 when I try to compile:
|
| struct S
| {
| uint ui;
| void function() func;
| long l;
| void[] va;
| byte b;
| void* vp;
| short[] delegate(Object) dg;
| char c;
| }
|
| size_t o_ui =   S.ui.offsetof;
| size_t o_func = S.func.offsetof;  // error
| size_t o_l =    S.l.offsetof;
| size_t o_va =   S.va.offsetof;
| size_t o_b =    S.b.offsetof;
| size_t o_vp =   S.vp.offsetof;    // error
| size_t o_dg =   S.dg.offsetof;
| size_t o_c =    S.c.offsetof;
|
|
| I get:
|
| $ dmd -c offsetof.d
| offsetof.d(14): no property 'offsetof' for type 'void()'
| offsetof.d(18): no property 'offsetof' for type 'void'

Added to DStress as
http://dstress.kuehne.cn/run/offsetof_09.d
http://dstress.kuehne.cn/run/offsetof_10.d
http://dstress.kuehne.cn/run/offsetof_11.d
http://dstress.kuehne.cn/run/offsetof_12.d
http://dstress.kuehne.cn/run/offsetof_13.d
http://dstress.kuehne.cn/run/offsetof_14.d
http://dstress.kuehne.cn/run/offsetof_15.d
http://dstress.kuehne.cn/run/offsetof_16.d
http://dstress.kuehne.cn/run/offsetof_17.d
http://dstress.kuehne.cn/run/offsetof_18.d
http://dstress.kuehne.cn/run/offsetof_19.d
http://dstress.kuehne.cn/run/offsetof_20.d
http://dstress.kuehne.cn/run/offsetof_21.d
http://dstress.kuehne.cn/run/offsetof_22.d
http://dstress.kuehne.cn/run/offsetof_23.d
http://dstress.kuehne.cn/run/offsetof_24.d
http://dstress.kuehne.cn/run/offsetof_25.d
http://dstress.kuehne.cn/run/offsetof_26.d
http://dstress.kuehne.cn/run/offsetof_27.d
http://dstress.kuehne.cn/run/offsetof_28.d
http://dstress.kuehne.cn/run/offsetof_29.d
http://dstress.kuehne.cn/run/offsetof_30.d
http://dstress.kuehne.cn/run/offsetof_31.d
http://dstress.kuehne.cn/run/offsetof_32.d
http://dstress.kuehne.cn/run/offsetof_33.d
http://dstress.kuehne.cn/run/offsetof_34.d
http://dstress.kuehne.cn/run/offsetof_35.d
http://dstress.kuehne.cn/run/offsetof_36.d
http://dstress.kuehne.cn/run/offsetof_37.d
http://dstress.kuehne.cn/run/offsetof_38.d
http://dstress.kuehne.cn/run/offsetof_39.d
http://dstress.kuehne.cn/run/offsetof_40.d
http://dstress.kuehne.cn/run/offsetof_41.d
http://dstress.kuehne.cn/run/offsetof_42.d
http://dstress.kuehne.cn/run/offsetof_43.d
http://dstress.kuehne.cn/run/offsetof_44.d
http://dstress.kuehne.cn/run/offsetof_45.d
http://dstress.kuehne.cn/run/offsetof_46.d
http://dstress.kuehne.cn/run/offsetof_47.d
http://dstress.kuehne.cn/run/offsetof_48.d
http://dstress.kuehne.cn/run/offsetof_49.d
http://dstress.kuehne.cn/run/offsetof_50.d
http://dstress.kuehne.cn/run/offsetof_51.d
http://dstress.kuehne.cn/run/offsetof_52.d
http://dstress.kuehne.cn/run/offsetof_53.d
http://dstress.kuehne.cn/run/offsetof_54.d
http://dstress.kuehne.cn/run/offsetof_55.d
http://dstress.kuehne.cn/run/offsetof_56.d
http://dstress.kuehne.cn/run/offsetof_57.d
http://dstress.kuehne.cn/run/offsetof_58.d
http://dstress.kuehne.cn/run/offsetof_59.d
http://dstress.kuehne.cn/run/offsetof_60.d
http://dstress.kuehne.cn/run/offsetof_61.d
http://dstress.kuehne.cn/run/offsetof_62.d
http://dstress.kuehne.cn/run/offsetof_63.d
http://dstress.kuehne.cn/run/offsetof_64.d
http://dstress.kuehne.cn/run/offsetof_65.d
http://dstress.kuehne.cn/run/offsetof_66.d
http://dstress.kuehne.cn/run/offsetof_67.d
http://dstress.kuehne.cn/run/offsetof_68.d
http://dstress.kuehne.cn/run/offsetof_69.d
http://dstress.kuehne.cn/run/offsetof_70.d
http://dstress.kuehne.cn/run/offsetof_71.d
http://dstress.kuehne.cn/run/offsetof_72.d
http://dstress.kuehne.cn/run/offsetof_73.d

Thomas

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFCMsZb3w+/yD4P9tIRApeoAJ9eTvkS/fKUV34rCAsNVAG0cccH9ACfUnch
N4NjqRiyVzinWisYScRfAp0=
=FF0X
-----END PGP SIGNATURE-----
Mar 12 2005