[clang][lex] NFCI: Use DirectoryEntryRef in ModuleMap::inferFrameworkModule()
[llvm-project.git] / clang / test / SemaTemplate / instantiate-template-argument.cpp
blob43d5d00c8cb2096d7f593894b7fab7973e7c7dc0
1 // RUN: %clang_cc1 -std=c++2a -x c++ %s -verify
3 template<auto T, decltype(T) U>
4 concept C1 = sizeof(U) >= 4;
5 // sizeof(U) >= 4 [U = U (decltype(T))]
7 template<typename Y, char V>
8 concept C2 = C1<Y{}, V>;
9 // sizeof(U) >= 4 [U = V (decltype(Y{}))]
11 template<char W>
12 constexpr int foo() requires C2<int, W> { return 1; }
13 // sizeof(U) >= 4 [U = W (decltype(int{}))]
15 template<char X>
16 // expected-note@+1{{candidate function}}
17 constexpr int foo() requires C1<1, X> && true { return 2; }
18 // sizeof(U) >= 4 [U = X (decltype(1))]
20 static_assert(foo<'a'>() == 2);
22 template<char Z>
23 // expected-note@+1{{candidate function}}
24 constexpr int foo() requires C2<long long, Z> && true { return 3; }
25 // sizeof(U) >= 4 [U = Z (decltype(long long{}))]
27 static_assert(foo<'a'>() == 3);
28 // expected-error@-1{{call to 'foo' is ambiguous}}