1 // RUN: %clang_cc1 -std=c++2a -x c++ %s -verify
2 
3 template<typename...>
4 concept C = false; // expected-note 9{{because}}
5 
6 template<typename T>
7 struct S {
8     template<typename U>
9     static void foo1(U a, auto b);
10     static void foo2(T a, C<T> auto b);
11     // expected-note@-1{{candidate template ignored}} expected-note@-1{{because}}
12     static void foo3(T a, C<decltype(a)> auto b);
13     // expected-note@-1{{candidate template ignored}} expected-note@-1{{because}}
14     static void foo4(T a, C<decltype(a)> auto b, const C<decltype(b)> auto &&c);
15     // expected-note@-1{{candidate template ignored}} expected-note@-1{{because}}
16 };
17 
18 using sf1 = decltype(S<int>::foo1(1, 2));
19 using sf2 = decltype(S<int>::foo2(1, 2)); // expected-error{{no matching function}}
20 using sf3 = decltype(S<int>::foo3(1, 2)); // expected-error{{no matching function}}
21 using sf4 = decltype(S<int>::foo4(1, 2, 3)); // expected-error{{no matching function}}
22 
23 
24 template<typename... T>
25 struct G {
26     static void foo1(auto a, const C<decltype(a)> auto &&... b);
27     // expected-note@-1{{candidate template ignored}} expected-note@-1{{because}} expected-note@-1 3{{and}}
28     static void foo2(auto a, const C<decltype(a), T> auto &&... b);
29     // expected-note@-1{{candidate template ignored}} expected-note@-1{{because}} expected-note@-1{{and}}
30 };
31 
32 using gf1 = decltype(G<int, char>::foo1('a', 1, 2, 3, 4)); // expected-error{{no matching function}}
33 using gf2 = decltype(G<int, char>::foo2('a', 1, 2)); // expected-error{{no matching function}}
34 
35 
36 // Regression (bug #45102): check that instantiation works where there is no
37 // TemplateTypeParmDecl
38 template <typename T> using id = T;
39 
40 template <typename T>
g()41 constexpr void g() {
42   id<void (T)> f;
43 }
44 
45 static_assert((g<int>(), true));