On Wed, Feb 27, 2019 at 02:29:32AM +0900, Mamoru TASAKA wrote:
Richard Shaw wrote on 2019/02/27 2:23:
> On Tue, Feb 26, 2019 at 11:17 AM Mamoru TASAKA <mtasaka(a)fedoraproject.org>
> wrote:
>
> > So... I guess Qt "foreach" behavior changed with gcc9..
> >
>
> Is there any chance this will change or magically get fixed if qt is
> rebuilt with gcc 9?
>
> Thanks,
> Richard
>
Well, foreach or Q_FOREACH is just a "#define" macro (from
/usr/include/Qt/qglobal.h and
/usr/include/QtCore/qglobal.h), so rebuilding qt(4) itself does not sense.
The Q_FOREACH macro relied on a G++ bug, which got fixed (in particular, g++
rejects forever break; and continue; in statement expressions
outside of a loop body (condition, init expr, increment expr) if there is
no outer loop, but due to a bug if it got past this check, for C++ would
jump to the break/continue labels of the inner rather than outer loop; for C
we got it right, and for GCC 9 finally fixed it.
You need the
https://github.com/qt/qtbase/commit/c35a3f519007af44c3b364b9af86f6a336f6411b
fix, which should be in reasonably recent Qt, but if some packages use very
old headers, the patch needs to be applied...
Note, clang/clang++ for some weird reason chose the non-sensical behavior.
Jakub