- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
C++11 SFINAE for expressions fails with Intel C++ 18.0 and Intel C++ 19.0 even though it succeds with vc++14.1 and vc++14.2. The code:
template<class> struct ignore { typedef void type; }; template<class T> T& object(); template<class T, class E = void> struct trait { static const int value = 0; }; template<class T> struct trait<T, typename ignore<decltype(&object<T>())>::type> { }; template<class T> struct result { static const int value = T::value; }; class type { void operator&() const { } }; int test() { return result<trait<type> >::value; } int main() { return test(); }
The error:
test_cxx11_sfinae_expression.cpp
test_cxx11_sfinae_expression.cpp(19): error: class "trait<type, void>" has no member "value"
static const int value = T::value;
^
detected during instantiation of class "result<T> [with T=trait<type, void>]" at line 28
The code also fails with earlier versions of Intel C++ on Windows but this is expected since it also fails with vc++14.0 on down. Since Intel C++ is compilng in C++14 mode by default, in order to emulate vc++ 14.1 on up, the code should compile correctly.
- Tags:
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've reported this issue to our Developer. Internal bug is CMPLRIL0-32339
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can use -Qoption,cpp,--no_c++11_sfinae_ignore_access flag as a workaround. Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Viet Hoang (Intel) wrote:You can use -Qoption,cpp,--no_c++11_sfinae_ignore_access flag as a workaround. Thanks,
Where is this command line option documented ?
I found that "-Qoption,cpp" passes the option designated after it to the preprocessor, so it sounds like I am passing "--no_c++11_sfinae_ignore_access" to the preprocessor, but I can not find any documentation on command line switches for the preprocessor.
Also why, when the default C++ level when using Intel C++ on Windows is C++14, do I have to use some option so that a C++11 feature works correctly ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your workaround worked but I would still like to know where the particular option passed to the preprocessor is documented. I did find preprocessor options at https://software.intel.com/en-us/cpp-compiler-developer-guide-and-reference-preprocessor-options but there is no mention there of --no_c++11_sfinae_ignore_access flag.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is an undocumented option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Viet Hoang (Intel) wrote:This is an undocumented option.
Are any options for the preprocessor documented ?
Why would this be turned off by default ? SFINAE for expressions is part of the C++11 standard on up and the default compilation for Intel C++ on Windows is C++14.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page