Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22045

When c++ instantiating method?

$
0
0

I am trying to compile this code with gcc and clang:

#include <iostream>
#include <type_traits>


template<int N>
struct Test
{
    template<typename = std::enable_if_t<N == 1, bool>>
    void func()
    {
        std::cout << "Test::func"<< std::endl;
    }
};

int main()
{
    Test<0> t;

    //t.func();
}

So, I have an error:

error: no type named 'type' in 'std::__1::enable_if<false, bool>'; 'enable_if' cannot be used to 
disable this declaration
template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type;

But if I compile that code with vc++ there is no error. So, which compiler resolves this issue according to c++ standard?


Viewing all articles
Browse latest Browse all 22045

Trending Articles



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