Debian Codegraph @

clang/test/SemaTemplate/explicit-instantiation-cxx20.cpp

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
2
3 template<class T>
4 concept C = true;
5
6 template<class T>
7 concept D = C<T> && true;
8
9 template<typename T>
10 struct a {
11 void no_candidate() requires(false) {}
12 // expected-note@-1 {{candidate function not viable: constraints not satisfied}} \
13 // expected-note@-1 {{because 'false' evaluated to false}}
14 void no_candidate() requires(false && false) {}
15 // expected-note@-1 {{candidate function not viable: constraints not satisfied}} \
16 // expected-note@-1 {{because 'false' evaluated to false}}
17
18 void subsumes();
19 void subsumes() requires C<T>;
20 void subsumes() requires D<T> {};
21
22 void ok() requires false;
23 void ok() requires true {};
24
25 void ok2() requires false;
26 void ok2(){};
27
28 void ambiguous() requires true;
29 // expected-note@-1 {{candidate function}}
30 void ambiguous() requires C<T>;
31 // expected-note@-1 {{candidate function}}
32 };
33 template void a<int>::no_candidate();
34 // expected-error@-1 {{no viable candidate for explicit instantiation of 'no_candidate'}}
35
36 template void a<int>::ambiguous();
37 // expected-error@-1 {{partial ordering for explicit instantiation of 'ambiguous' is ambiguous}}
38
39 template void a<int>::ok();
40 template void a<int>::ok2();