[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / SemaTemplate / subst-into-subst.cpp
blob69c4a837864dc3b1e020cb19fa4527e7b2fd53ee
1 // RUN: %clang_cc1 -std=c++2a -verify %s
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.
8 namespace SubstIntoResolvedTypeTemplateArg {
9 template<int, class> struct X {};
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>>;
15 int f(A auto); // expected-note {{candidate}}
16 int f(C auto); // expected-note {{candidate}}
17 int k1 = f(0); // expected-error {{ambiguous}}
19 template<class T> concept D = A<T> && B<X<1, T>>;
20 int f(D auto);
21 int k2 = f(0); // ok
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);
32 int g(D auto); // expected-note {{candidate}}
33 int k4 = g(0); // expected-error {{ambiguous}}