This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/62057] New: __builtin_offsetof works but std::offsetof doesn't


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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]