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 };
7 struct optional_ctor_base
{};
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
;
16 struct optional
: optional_ctor_base
<ctor_copy_traits
<T
>::traits
> {
18 constexpr optional(U
&& v
);
27 XB(const optional
<B
>&);
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
{
40 concept AlwaysTrue
= true;
43 int f(AlwaysTrue
auto) { return 1; }
44 void f(this S
&&, 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}}
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}}
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'}}