<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 --- - regression in r193073"
href="http://llvm.org/bugs/show_bug.cgi?id=17649">17649</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>regression in r193073
</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>Linux
</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>mrmocool@gmx.de
</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><a href="http://llvm-reviews.chandlerc.com/D1762">http://llvm-reviews.chandlerc.com/D1762</a>
gcc (v4.8.1, Ubuntu 13.10) does indeed reject
for ( ; ({ if (first) { first = 0; continue; } 0; }); )
but it still accepts Qt 4.8.4's foreach (which seems to be the same in Qt 5.2).
Clang now rejects even the most basic use of that.
Please clarify if it needs to be changed in clang, g++ or Qt.
It seems like the semantics of this extension aren't all that clear:
<a href="http://gcc.gnu.org/ml/gcc-help/2013-07/msg00155.html">http://gcc.gnu.org/ml/gcc-help/2013-07/msg00155.html</a>
Here's the partially preprocessed code:
#include <vector>
#include <iostream>
template <typename T>
class QForeachContainer
{
public:
inline QForeachContainer(const T& t)
: c(t), brk(0), i(c.begin()), e(c.end())
{
}
const T c;
int brk;
typename T::const_iterator i, e;
};
int main()
{
std::vector<int> v(10);
for (QForeachContainer<__typeof__(v)> _container_(v);
!_container_.brk && _container_.i != _container_.e;
__extension__({ ++_container_.brk; ++_container_.i; })
)
for (int val = *_container_.i;
;
__extension__({--_container_.brk; break; })
)
std::cout << val << " ";
}</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>