1 // { dg-do compile { target c++11 } } 2 // { dg-options "-fconcepts" } 3 4 // This is like pr84979-2.C, except that we swap the types passed to 5 // the template functions foo1 and foo2, so that the expectations WRT 6 // D's typeness are not met. 7 8 template <typename T> foo1(T & t)9void foo1(T& t) { 10 typename T::template C<void> tcv = t; 11 typename T::template C<auto> u = tcv; 12 T::template C<auto>::f (tcv, u); // { dg-error "incomplete" } 13 (typename T::template D<auto> (t)); // { dg-error "invalid" } 14 } 15 16 struct T1 { 17 template <typename T> struct C { 18 C(T1&); 19 static void f(T1&, C&); 20 }; 21 template <typename T> struct D { 22 D(T1&); 23 }; 24 }; 25 26 template <typename T> foo2(T & t)27void foo2(T& t) { 28 typename T::template C<void> tcv = t; 29 typename T::template C<auto> u = tcv; 30 T::template C<auto>::f (tcv, u); // { dg-error "incomplete" } 31 T::template D<auto> (t); // { dg-error "yields a type" } 32 } 33 34 struct T2 { 35 template <typename T> struct C { 36 C(T2&); 37 static void f(T2&, C&); 38 }; 39 template <typename T> static void D(T2&); 40 }; 41 f(T1 & t1,T2 & t2)42void f(T1& t1, T2& t2) { 43 foo1 (t2); 44 foo2 (t1); 45 } 46