1 // Testcase from P1814R0 2 // { dg-do compile { target c++2a } } 3 4 template <class T> struct identity { using type = T; }; 5 template <class T> using identity_t = typename identity<T>::type; 6 template <class T> concept Int = __is_same_as (T, int); 7 8 template <class T, class U> struct C { 9 C(T, U); // #1 { dg-message "constraint" } 10 }; 11 template<class T, class U> 12 C(T, U) -> C<T, identity_t<U>>; // #2 { dg-message "constraint" } 13 14 template<class V> 15 using A = C<V *, V *>; 16 17 template<Int W> 18 using B = A<W>; 19 20 int i{}; 21 double d{}; 22 A a1(&i, &i); // { dg-bogus "" "Deduces A<int>" } 23 A a2(i, i); // { dg-error "" "cannot deduce V * from i" } 24 A a3(&i, &d); // { dg-error "" } #1: Cannot deduce (V*, V*) from (int *, double *) 25 // #2: Cannot deduce A<V> from C<int *, double *> 26 B b1(&i, &i); // { dg-bogus "" "Deduces B<int>" } 27 B b2(&d, &d); // { dg-error "" "cannot deduce B<W> from C<double *, double *>" } 28