This compiles without errors for both clang and gcc, but does not work with MSVC: ( compiler explorer )
// detection idiom template <class...> using void_t = void; template <class Void, template <class...> class Op, class... Args> struct detector_base { using type = void; }; template <template <class...> class Op, class... Args> struct detector_base<void_t<Op<Args...>>, Op, Args...> { using type = Op<Args...>; }; template <class T> using check = decltype(T::x); template <typename T> struct type {}; using dt = typename detector_base<void, check, int>::type; // this is void using t = type<dt>; // ^--- 't': use of class template requires template argument list
This happens when using the detected type with any type of template. Is this a compiler error or due to lack of support (if so, why)?
c ++ templates c ++ 14
ralismark
source share