http://llvm.org/bugs/show_bug.cgi?id=17650
Bug ID: 17650
Summary: Clang fails to build Qt applications using a foreach
convenience macro
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
Qt offers a convenience macro called foreach to iterate over values of a list,
etc. This expands to the following:
for (QForeachContainer<__typeof__(m_components)> _container_(m_components);
!_container_.brk && _container_.i != _container_.e; __extension__ ({
++_container_.brk; ++_container_.i; })) for (QObject *component =
*_container_.i;; __extension__ ({--_container_.brk; break;})) {
Clang will now complain about this with the following error message:
... error: 'break' statement not in loop or switch statement body
which is indeed what is happening. I am not positive whether this is legal C++
or not, but this is used in Qt since before 2011 and has never been a problem
so far on any of the supported platforms.
I assume this is introduced by
https://llvm.org/svn/llvm-project/cfe/trunk@193073
which removes a test case similar to what is used in Qt from the
trunk/test/Analysis/dead-stores.c. That commit message claims that GCC rejects
this, but it does not using gcc <= 4.8.1.
Please reintroduce this behavior (or at least provide a switch to turn it off)
to avoid breaking the build of (almost) *all* Qt applications in existence
using clang.
Yes, we should fix Qt to not do this, but we can not retro-actively fix all the
Qt sources out there and people will encounter this issue when building any Qt
source code with clang.
Also note that http://llvm.org/bugs/show_bug.cgi?id=7189 fixes the Qt foreach
macro, so there was work done to introduce this behavior in the first place.
--
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