http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51413

             Bug #: 51413
           Summary: Broken diagnostic with __builtin_offsetof
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: reich...@gcc.gnu.org


A broken diagnostic is generated for the following invalid code snippet since
GCC 4.1.2:

=============================================
struct A
{
  static void foo();
};

int i = __builtin_offsetof(A, foo[1][1]);
=============================================

bug.cc:6:36: warning: pointer to a function used in arithmetic
[-Wpointer-arith]
bug.cc:6:39: warning: pointer to a function used in arithmetic
[-Wpointer-arith]
bug.cc:6:40: error: cannot apply 'offsetof' to member function '#'indirect_ref'
not supported by dump_decl#<declaration error>'

Reply via email to