http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50608
Bug #: 50608
Summary: cannot apply 'offsetof' to a non constant address
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
$ cat repro.ii
struct A {
int offset;
};
struct B: public A {
};
struct C {
A a;
B b;
};
/* error: cannot apply 'offsetof' to a non constant address */
int fails = __builtin_offsetof (C, b.offset);
int works = (int)(&(((C*)0)->b.offset));
$
looks like a dup of Bug 13648, which claims to be fixed.