http://llvm.org/bugs/show_bug.cgi?id=17649
Bug ID: 17649
Summary: regression in r193073
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
http://llvm-reviews.chandlerc.com/D1762
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:
http://gcc.gnu.org/ml/gcc-help/2013-07/msg00155.html
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 << " ";
}
--
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