1 // RUN: %clang_cc1 -std=c++20 -verify %s
2 // RUN: %clang_cc1 -std=c++23 -verify %s
5 template <class> concept C
= true;
13 concept Beginable
= requires (T t
) {
15 // expected-note@-1 {{because 't.begin' would be invalid: reference to non-static member function must be called}}
18 static_assert(Beginable
<A
>); // expected-error {{static assertion failed}}
19 // expected-note@-1 {{does not satisfy 'Beginable'}}
20 } // namespace PR52905
24 template<class> constexpr bool B
= true;
25 template<class T
> concept True
= B
<T
>;
28 int foo(T t
) requires requires
{ // expected-note {{candidate template ignored: constraints not satisfied}}
29 {t
.begin
} -> True
; // expected-note {{because 't.begin' would be invalid: reference to non-static member function must be called}}
33 struct A
{ int begin(); };
34 auto x
= foo(A()); // expected-error {{no matching function for call to 'foo'}}
36 } // namespace PR52909a
40 template<class> concept True
= true;
42 template<class T
> concept C
= requires
{
43 { T::begin
} -> True
; // expected-note {{because 'T::begin' would be invalid: reference to overloaded function could not be resolved}}
47 static void begin(int);
48 static void begin(double);
51 static_assert(C
<A
>); // expected-error {{static assertion failed}}
52 // expected-note@-1 {{because 'A' does not satisfy 'C'}}
54 } // namespace PR52909b
57 template<class> concept True
= true;
59 template<class T
> concept C
= requires
{
60 { &T::f
} -> True
; // expected-note {{because '&T::f' would be invalid: reference to overloaded function could not be resolved}}
68 static_assert(C
<S
>); // expected-error {{static assertion failed}}
69 // expected-note@-1 {{because 'S' does not satisfy 'C'}}
71 } // namespace PR53075