Incomplete type until C++17?

Viewed 321

I thought the code below was valid C++11, but GCC (g++ (GCC) 8.0.0 20170528) rejects it; reporting that the variable f has an incomplete type. It does though compile with the -std=c++17 flag. Can anyone 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;
0 Answers
Related