https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70563
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid Status|UNCONFIRMED |NEW Last reconfirmed| |2016-06-16 CC| |msebor at gcc dot gnu.org Summary|SFINEA fails when trying |SFINAE fails when trying |invalid template |invalid template |instantiation |instantiation Ever confirmed|0 |1 Known to fail| |4.9.3, 5.3.0, 6.1.0, 7.0 --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- I'm not 100% sure the code is valid but I can't find anything wrong with it and I don't think the error message is correct. The type it complains about being incomplete seems complete to me. I'm going to confirm this with the slightly reduced test case that should also make clear which type is being instantiated by which expression. I note that Clang 3.8 does compile it as mentioned, though EDG eccp does not (though the error it issues suggests it's confused by the complicated templates). All recent versions of GCC fail to compile the test case, although 4.9.3 with a different error: ‘b’ is not a member of ‘C<D>::CC<B<int> >’. $ cat u.C && /home/msebor/build/gcc-trunk-svn/gcc/xgcc -B /home/msebor/build/gcc-trunk-svn/gcc -Wall -Wextra -Wpedantic u.C template <class...> using A = void; template <class> struct B { }; template <template <class...> class T> struct C { template <class, class = A<>> struct CC { enum { b = 0 }; }; template <template <class...> class U, class... Ts> struct CC<U<Ts...>, A<T<Ts..., float> > > { enum { a = 1 }; }; }; template <class> struct D { }; template <class, class> struct E { }; enum { a = C<E>::CC<B<int>>::a, b = C<D>::CC<B<int>>::b }; u.C:19:7: error: incomplete type ‘C<D>::CC<B<int> >’ used in nested name specifier b = C<D>::CC<B<int>>::b ^~~~