I thought the code below was valid C ++ 11, but GCC (g ++ (GCC) 8.0.0 20170528) rejects it; reporting that the variable f
is of an incomplete type. It compiles with the flag -std=c++17
. Can someone tell me why?
#include <type_traits>
template <class> struct Foo;
template <
template <template <class ...> class> class MM,
template <class...> class M
>
struct Foo<MM<M>> {};
template <template <class ...> class, class...>
struct Bar { };
Foo<Bar<std::add_pointer>> f;
source
share