1 // RUN: %clang_cc1 -std=c++2a -verify %s 2 3 // When forming and checking satisfaction of atomic constraints, we will 4 // substitute still-dependent template arguments into an expression, and later 5 // substitute into the result. This creates some unique situations; check that 6 // they work. 7 8 namespace SubstIntoResolvedTypeTemplateArg { 9 template<int, class> struct X {}; 10 11 template<class T> concept A = true; 12 template<class T> concept B = sizeof(T) != 0; 13 template<class T> concept C = B<X<1, T>>; 14 15 int f(A auto); // expected-note {{candidate}} 16 int f(C auto); // expected-note {{candidate}} 17 int k1 = f(0); // expected-error {{ambiguous}} 18 19 template<class T> concept D = A<T> && B<X<1, T>>; 20 int f(D auto); 21 int k2 = f(0); // ok 22 23 // The atomic constraint formed from B<X<(int)'\1', T>> is identical to the 24 // one formed from C, even though the template arguments are written as 25 // different expressions; the "equivalent" rules are used rather than the 26 // "identical" rules when matching template arguments in concept-ids. 27 template<class T> concept E = A<T> && B<X<(int)'\1', T>>; 28 int g(C auto); 29 int g(E auto); // expected-note {{candidate}} 30 int k3 = g(0); 31 32 int g(D auto); // expected-note {{candidate}} 33 int k4 = g(0); // expected-error {{ambiguous}} 34 } 35