Community
cancel
Showing results for 
Search instead for 
Did you mean: 
sav
Novice
140 Views

WIN64: 'expected a "{" ... namespace NS [[deprecated]] { }' error for QtBase 'compiler' autotest build

Jump to solution

Hello, everyone,

For QtBase 'compiler' autotest build using Windows ICC got error:

        icl -c -nologo -Zm200 /Qprec /Qwd1744,1738,809,3373 /Zc:forScope -O2 -MD -Qstd=c++14 -EHsc -W3 /Qwd673 -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -DQT_NO_DEBUG -DQT_FORCE_ASSERTS -DQT_TESTLIB_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR="\"C:/libQT-5.11-dev/build/qtbase/tests/auto/other/compiler\"" -DNDEBUG -I. -I..\..\..\..\include -I..\..\..\..\include\QtTest -I..\..\..\..\include\QtCore -Itmp\moc\release -I..\..\..\..\mkspecs\win32-icc -Fo.obj\release\ @C:\Users\test\AppData\Local\Temp\nmC271.tmp
tst_compiler.cpp
.\tst_compiler.cpp(696): error: expected a "{"
  namespace NS [[deprecated]] { }
               ^

.\tst_compiler.cpp(729): warning #2633: attributes are not allowed here
      [[ ]] void [[ ]] * [[ ]] * [[ ]] ptr = 0;
                            ^

.\tst_compiler.cpp(729): warning #2633: attributes are not allowed here
      [[ ]] void [[ ]] * [[ ]] * [[ ]] ptr = 0;
                                    ^

.\tst_compiler.cpp(730): warning #2633: attributes are not allowed here
      int B::* [[ ]] pmm = 0;
                  ^

.\tst_compiler.cpp(765): warning #2633: attributes are not allowed here
      int & [[ ]] lref = i;
               ^

.\tst_compiler.cpp(766): warning #2633: attributes are not allowed here
      int && [[ ]] rref = 1;
                ^

compilation aborted for .\tst_compiler.cpp (code 2)
NMAKE : fatal error U1077: '"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\bin\intel64\icl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.

(ICC-preprocessed version added in attachment). Qt Developers believe it's a compiler bug.

 

Reproduced for:
  - Qt5-dev builds using Windows ICC,

not reproduced for:
  - Qt5-dev builds using mingw-w64 and MSVC.

 

Environment:

 

Best,

Alexander

 

0 Kudos
1 Solution
Judith_W_Intel
Employee
140 Views

 

I've only looked at the error (not the warnings).

For this small test case:

namespace NS [[deprecated]] { }

The latest version of MSVC++ I tried gives a similar compilation error. The latest version of GNU gives a warning (even with -std=c++17).

According to this paper the deprecated attribute is not allowed on namespaces in c++14:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3760.html

In c++17 the attribute specifier is allowed on namespaces but not after the namespace name:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4266.html

so this compiles (with both MSVC and icl and is I think the only correct syntax:

namespace [[deprecated]] NS { }

It does look like (at least some) of the warnings coming from icl are incorrect - I will look at those and post another followup later..

Judy.

View solution in original post

2 Replies
Judith_W_Intel
Employee
141 Views

 

I've only looked at the error (not the warnings).

For this small test case:

namespace NS [[deprecated]] { }

The latest version of MSVC++ I tried gives a similar compilation error. The latest version of GNU gives a warning (even with -std=c++17).

According to this paper the deprecated attribute is not allowed on namespaces in c++14:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3760.html

In c++17 the attribute specifier is allowed on namespaces but not after the namespace name:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4266.html

so this compiles (with both MSVC and icl and is I think the only correct syntax:

namespace [[deprecated]] NS { }

It does look like (at least some) of the warnings coming from icl are incorrect - I will look at those and post another followup later..

Judy.

View solution in original post

sav
Novice
140 Views

Thank you for answer, Judith.

Qt Developers confirmed, that it's a Qt bug, and approved a fix (see Change #222672). Although noted, that rest of warnings are likely relate to the compiler.

 

Best,

Alexander

 

Reply