I have two versions of the what I'd expect to be the same function but gcc says version 1 is valid while version 2 gives a
expected a type, got 'std::remove_cv<_Iter>::type'
I don't quite understand this error, as I'd expect that the using
statement required a type, and wouldn't automatically promote a 'std::remove_cv<_Iter>::type'
to something else?
Can somebody explain whats going on here?
template<typename U,typename V> constexpr inline auto is_same_rcv() noexcept
{
//version 1 works
using u_underlying = std::remove_cv<U>::type;
using v_underlying = std::remove_cv<V>::type;
return std::is_same<u_underlying,v_underlying>::value;
}
and
template<typename U,typename V> constexpr inline auto is_same_rcv() noexcept
{
//version 2 doesn't work
using u_underlying = std::remove_cv<U>::type;
return std::is_same<u_underlying,std::remove_cv<V>::type>::value;
}
Associated godbolt
Edit for fun, it looks like clang and gcc different on the interpretation of the using keyword (see https://godbolt.org/z/P9Pcn6)