1 // RUN: %clang_cc1 -std=c++2a -verify %s
4 // expected-note@-1 {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'S1<int>' to 'const S2' for 1st argument}}
5 // expected-note@-2 {{candidate constructor (the implicit move constructor) not viable: no known conversion from 'S1<int>' to 'S2' for 1st argument}}
6 // expected-note@-3 {{candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided}}
10 void foo() const requires
true {}
11 void foo() const requires
false {}
12 void bar() const requires
false {}
13 // expected-note@-1 {{because 'false' evaluated to false}}
14 operator bool() const requires
true { return true; }
15 explicit operator bool() const requires
false;
16 explicit operator S2() const requires
false;
17 // expected-note@-1 {{candidate function not viable: constraints not satisfied}}
18 // expected-note@-2 {{because 'false' evaluated to false}}
24 // expected-error@-1 {{invalid reference to function 'bar': constraints not satisfied}}
25 (void) static_cast<bool>(S1
<int>());
26 (void) static_cast<S2
>(S1
<int>());
27 // expected-error@-1 {{no matching conversion for static_cast from 'S1<int>' to 'S2'}}
30 // Test that constraints are checked before implicit conversions are formed.
33 struct invalid_template
{ using X
= typename
T::non_existant
; };
35 template<typename T
, bool=invalid_template
<T
>::aadasas
>
41 static void foo(int) requires
false;
42 static void foo(A
) requires
true;
47 void foo(int) requires
false;
48 void foo(A
) requires
true;
50 S(double) requires
true;
53 operator int() requires
true;
54 operator int() requires
false;
58 WrapsStatics
<int>::foo(A
{});