<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - GCC extension rejected in C++ mode"
href="http://llvm.org/bugs/show_bug.cgi?id=19556">19556</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>GCC extension rejected in C++ mode
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>benny.kra@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>