mirror of
https://github.com/dlang/dmd.git
synced 2025-04-27 05:30:13 +03:00
15 lines
441 B
C
15 lines
441 B
C
// https://issues.dlang.org/show_bug.cgi?id=22809
|
|
|
|
typedef unsigned long size_t;
|
|
|
|
// #define __builtin_offsetof(t,i) ((size_t)((char *)&((t *)0)->i - (char *)0))
|
|
|
|
struct Foo {
|
|
int x, y;
|
|
};
|
|
|
|
//int y = __builtin_offsetof(struct Foo, y);
|
|
//_Static_assert(__builtin_offsetof(struct Foo, y)==4, "");
|
|
|
|
int y = ((size_t)((char *)&((struct Foo *)1)->x - (char *)1));
|
|
_Static_assert(((size_t)((char *)&((struct Foo *)0)->y - (char *)0))==4, "");
|