[LLVMbugs] [Bug 19556] New: GCC extension rejected in C++ mode
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Apr 25 05:28:09 PDT 2014
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: unassignedclangbugs at nondot.org
Reporter: benny.kra at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140425/c1a66af5/attachment.html>
More information about the llvm-bugs
mailing list