http://llvm.org/bugs/show_bug.cgi?id=19556

            Bug ID: 19556
           Summary: GCC extension rejected in C++ mode
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

Here's some evil code from glibc's mathinline.h.

$ cat evil.cc
int foo(double __x) {
  return (__extension__
          (((((union { double __d; int __i[2]; }) {__d: __x}).__i[1]))));
}

$ clang evil.cc
evil.cc:3:17: error: '(anonymous union at evil.cc:3:17)' cannot be defined in a
type specifier
           (((((union { double __d; int __i[2]; }) {__d: __x}).__i[1]))));
                ^
evil.cc:3:53: warning: use of GNU old-style field designator extension
[-Wgnu-designator]
           (((((union { double __d; int __i[2]; }) {__d: __x}).__i[1]))));
                                                    ^~~~
                                                    .__d = 
evil.cc:3:63: error: member reference base type 'void' is not a structure or
union
           (((((union { double __d; int __i[2]; }) {__d: __x}).__i[1]))));
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
1 warning and 2 errors generated.

We accept this beast in C mode, but reject it as C++. GCC accepts it in C++
code too.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to