https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98345
--- Comment #4 from Peter Budek <budek at wtal dot de> --- The requested test-case: #include <iostream> #include <QtCore/QList> int main(int argc, char *argv[]) { QList<int> l ; l.append(1) ; l.append(2) ; l.append(3) ; foreach(int i, l) std::cout << i << std::endl ; return(0) ; } The result is '1' with gcc 10.2.0 (not 1 2 3). I found this compiling qucs (http://qucs.sourceforge.net/index.html). patching qt helps: +++ qt-everywhere-opensource-src-4.8.7/src/corelib/global/qglobal.h 2020-12-17 10:46:30.000000000 +0100 @@ -2496,9 +2496,9 @@ #define Q_FOREACH(variable, container) \ for (QForeachContainer<__typeof__(container)> _container_(container); \ !_container_.brk && _container_.i != _container_.e; \ __extension__ ({ ++_container_.brk; ++_container_.i; })) \ - for (variable = *_container_.i;; __extension__ ({--_container_.brk; break;})) + for (variable = *_container_.i;!_container_.brk; __extension__ ({--_container_.brk;})) #else struct QForeachContainerBase {};