[X86] Move getGFNICtrlMask before CTLZ/CTTZ lowering. NFC.
[llvm-project.git] / clang / test / SemaCXX / overload-template.cpp
blob3277a17e5e45080571f15cf3bd3d1dd96b231346
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -std=c++23 -verify -fsyntax-only %s
4 enum copy_traits { movable = 1 };
6 template <int>
7 struct optional_ctor_base {};
8 template <typename T>
9 struct ctor_copy_traits {
10 // this would produce a c++98-compat warning, which would erroneously get the
11 // no-matching-function-call error's notes attached to it (or suppress those
12 // notes if this diagnostic was suppressed, as it is in this case)
13 static constexpr int traits = copy_traits::movable;
15 template <typename T>
16 struct optional : optional_ctor_base<ctor_copy_traits<T>::traits> {
17 template <typename U>
18 constexpr optional(U&& v);
20 struct A {};
21 struct XA {
22 XA(const A&);
24 struct B {};
25 struct XB {
26 XB(const B&);
27 XB(const optional<B>&);
29 struct YB : XB {
30 using XB::XB;
32 void InsertRow(const XA&, const YB&); // expected-note {{candidate function not viable: no known conversion from 'int' to 'const XA' for 1st argument}}
33 void ReproducesBugSimply() {
34 InsertRow(3, B{}); // expected-error {{no matching function for call to 'InsertRow'}}
37 #if __cplusplus >= 202302L
38 namespace overloadCheck{
39 template<typename T>
40 concept AlwaysTrue = true;
42 struct S {
43 int f(AlwaysTrue auto) { return 1; }
44 void f(this S&&, auto) {}
46 void g(auto) {}
47 int g(this S&&,AlwaysTrue auto) {return 1;}
49 int h(AlwaysTrue auto) { return 1; } //expected-note {{previous definition is here}}
50 int h(this S&&,AlwaysTrue auto) { // expected-error {{class member cannot be redeclared}}
51 return 1;
55 int main() {
56 int x = S{}.f(0);
57 int y = S{}.g(0);
60 #endif
62 namespace GH93076 {
63 template <typename ...a> int b(a..., int); // expected-note-re 3 {{candidate function template not viable: no known conversion from 'int ()' to 'int' for {{.*}} argument}}
64 int d() {
65 (void)b<int, int>(0, 0, d); // expected-error {{no matching function for call to 'b'}}
66 (void)b<int, int>(0, d, 0); // expected-error {{no matching function for call to 'b'}}
67 (void)b<int, int>(d, 0, 0); // expected-error {{no matching function for call to 'b'}}
68 return 0;