Facing the limitation when using Q_FOREACH MACRO and a Qt gnu compiler (Q_CC_GNU), it could be possible to replace the MACRO by another:
Copy from QtCore/qglobal.h in the configuration file folder
and rename it mygglobal.h
Search for the MACRO Q_FOREACH around line 2244 and replace it with MACRO (use flag of compilation to encapsulate new MACRO definition):
@#define Q_FOREACH(variable, container)
QForeachContainer<typeof(container)> container(container);
for (variable = *container.i;
!container.brk && container.i != container.e;
++container.i)@
Relaunch using -include myqglobal.h. Note that it does not work if Q_FOREACH MACRO is used more than one time in same statement.