Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

"inline namespace" broken with /Qvc** in ICPC 18.0 + Visual Studio 2017

Andreas_R_1
Beginner
896 Views

The headers "chrono", "string" and "complex" shipped with Visual Studio 2017 (C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include) are currently broken with "Intel C++ Compiler 18.0".

Microsoft has switched these headers to make use of "inline namespace" (C++14, "std::literals" has become an inline namespace), and icpc fails parsing these when operating in MSVC compatbility mode (/Qvc14).

It does not emit the warnings it would have when operating in a pre-C++11 standard ("inline can only be used on ..."), but fails straight out with a parser error ("identifier expected" on the "namespace" keyword).

The headers for "std::experimental" shipped with VS2017 make even heavier use of the "inline namespace" feature and are essentially all broken.

0 Kudos
7 Replies
Judith_W_Intel
Employee
896 Views

 

"inline namespace" is enabled in 18.0 when MSVC++ 2015 compatibility mode is in effect. See below.

What command line options are you using? Does the example below compile for you? If not does it compile if you explicitly specify /Qvc14?

Judy

bash-3.2$ cat t.cpp

namespace N {
inline namespace {
}
}
bash-3.2$ icl -c t.cpp
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Versi
on 18.0 Beta Build x
Built Sep 22 2017 17:30:02 by jward4 on JWARD4-DESK1 in D:/workspaces/18_0cfe/de
v
Copyright (C) 1985-2017 Intel Corporation.  All rights reserved.

t.cpp
bash-3.2$

 

 

0 Kudos
Andreas_R_1
Beginner
896 Views

Yes, the minimal example builds.

It was actually a fault on my side. Found an ancient header which had a "#define inline __inline" in it. That one broke the std headers.

Both Clang/C2 and MSVC did actually accept "__inline namespace [identifier]" and handle it as expected, so I didn't notice.

ICPC didn't.

0 Kudos
Anoop_M_Intel
Employee
896 Views

We have captured the Chrono header issue in our internal tracker CMPLRS-47574

0 Kudos
Judith_W_Intel
Employee
896 Views

 

Anoop, this customer complaint has nothing to do with cmplrs-47574 (which is fixed in 18.0 which is what the customer said they were using).

This was a complaint about the "inline namespace" feature not working correctly.

Judy

0 Kudos
ivan_d_
Beginner
896 Views

Confirm the inline namespace issue.

I'm trying to use it together with /Qvc14.1 and msvc 2017 headers but still get the error from icl 18.0

0 Kudos
Andreas_R_1
Beginner
896 Views
"inline namespace" works. "__inline namespace" doesn't. Look if you have any header which has a "#define inline __inline" in it. That might be the case for headers which were written for ancient MSVC versions.
0 Kudos
ivan_d_
Beginner
896 Views

Andreas R. wrote:

"inline namespace" works. "__inline namespace" doesn't.

Look if you have any header which has a "#define inline __inline" in it. That might be the case for headers which were written for ancient MSVC versions.

Thanks! That is the case :)

0 Kudos
Reply