0

I have a simple test program here which outputs a different result when compiling on gcc-4.9.3 and gcc-5.1

#include <iostream>

template< class... >
using void_t = void;

template<class, class = void_t<>>
struct has_member_type : std::false_type
{ };

template<class T>
struct has_member_type<T, void_t<typename T::type>> : std::true_type
{ };

int main()
{
    std::cout << has_member_type<int>::value << '\n';

    return 0;
}

gcc-4.9.3 output:

1

gcc-5.1 output:

0

I've been unable to find an online compiler which allows me to compile with two different compiler versions.

However, I have found two separate online compilers which have difference compiler versions:

Question:

  • Why does gcc-4.9.3 output 1 when there is clearly no member int::type?
Rudy Velthuis
  • 28,387
  • 5
  • 46
  • 94
Steve Lorimer
  • 27,059
  • 17
  • 118
  • 213

0 Answers0