[Development] QtCS: Notes from Modern C++ session

Thiago Macieira thiago.macieira at intel.com
Tue Dec 1 17:04:39 CET 2015

On Tuesday 01 December 2015 10:00:29 Marc Mutz wrote:
> On Tuesday 16 June 2015 22:31:51 Thiago Macieira wrote:
> >  MSVC 2012 and 2013 have a parsing bug with them, so you need to
> > 
> > compile your code with one of those two versions if you're introducing new
> > range fors.
> Do you have specifics here? IIRC, it was something like
>    while (...)
>        for (... : .... )  {
>        }
> which is excluded by our coding standard (missing braces), so it can never
> happen.

It fails to compile tst_compiler.cpp's cxx11_range_for.

    for (int i : l)
        QCOMPARE(i, 1);

The reduced testcase, which I sent to Microsoft but can no longer find, is when 
you have a while inside a for. I don't remember whether the braces are 
required or must be absent or not.

This one is reported to still have a problem with 2015:

There's another one with try/catch, but I can't find my log in to read the 

See also this still open report: 
for (const auto &outer : v)
            for (const auto &item : outer)
                do {} while (false);

Anyway, the rule for Qt 5.7 is that you can use range fors, as long as you 
first compile your code with VS 2012 or 2013 due to their various parsing bugs. 
Don't submit to the CI until you have tested yourself or someone has on your 

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

More information about the Development mailing list