Incomplete type before C ++ 17?

I thought the code below was valid C ++ 11, but GCC (g ++ (GCC) 8.0.0 20170528) rejects it; reporting that the variable fis 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;
+4
source share

Source: https://habr.com/ru/post/1685810/


All Articles