Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

Syntax issue Intel vs. Visual C++

$
0
0

The following code will compile in Visual C++ 2015 Update 1, but not in Intel C++ 2016 Update 2.  It gives the error:

test.cpp
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\type_traits(1692): error: class "std::enable_if<0, void>" has no member "type"
                using enable_if_t = typename enable_if<_Test, _Ty>::type;
                                                                    ^
          detected during:
            instantiation of type "std::enable_if_t<0, void>" at line 10 of "test.cpp"
            instantiation of class "Test<T, Args...> [with T=int, Args=<>]" at line 18 of "test.cpp"

Is Intel C++ wrong?  Thanks.

#include <type_traits>

template <typename T, typename... Args>
class Test
{
public:
 Test(T pT)
 {
 }
 template <typename = std::enable_if_t<sizeof...(Args) != 0>>
 Test(T pT, Args... args)
 {
 }
};

int main()
{
 Test<int> t(0);
 Test<int, int> t2(0, 0);

}

 


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>