https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62057
Bug ID: 62057 Summary: __builtin_offsetof works but std::offsetof doesn't Product: gcc Version: 4.6.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: igodard at pacbell dot net This code: #include <cstddef> class A { public: int i; }; int main() { int x = __builtin_offsetof(A, i); int j = std::offsetof(A, i); } gets you this: s6:~/ootbc/genAsm$ gcc foo.cc foo.cc: In function âint main()â: foo.cc:10:16: error: expected unqualified-id before â__builtin_offsetofâ foo.cc:10:16: error: expected â,â or â;â before â__builtin_offsetofâ Version: s6:~/ootbc/genAsm$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/gcc/4.6.4/libexec/gcc/x86_64-unknown-linux-gnu/4.6.4/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-4.6.4/configure --prefix=/usr/local/gcc/4.6.4 --libdir=/usr/local/gcc/4.6.4/lib64 --enable-languages=c,c++ Thread model: posix gcc version 4.6.4 (GCC)