1 // RUN: %clang_cc1 -std=c++20 -verify %s
2 // RUN: %clang_cc1 -std=c++20 -verify %s -triple powerpc64-ibm-aix
9 auto f
= []() requires c
<void> {
22 auto f
= [](auto... args
) requires c
<T
> {
26 auto f2
= [](auto... args
)
27 requires (sizeof...(args
) > 0)
37 template<class> concept C
= true;
38 template<int> constexpr bool v
= [](C
auto) { return true; }(0);
42 template<class> concept C
= true;
43 template<int> constexpr bool v
= [](C
auto...) { return true; }(0);
52 auto f
= [](any
auto) {
55 using function_ptr
= void(*)(int);
56 function_ptr ptr
= f
<void>;
59 // GH58368: A lambda defined in a concept requires we store
60 // the concept as a part of the lambda context.
61 namespace LambdaInConcept
{
62 using size_t = unsigned long;
67 template <class T
, class... Ts
>
68 concept NotLike
= true;
70 template <size_t, class... Ts
>
72 template <NotLike
<Ts
...> T
> operator T
&() const;
73 template <NotLike
<Ts
...> T
> operator T
&&() const;
77 concept ConstructibleWithN
= (requires
{
78 []<size_t I
, size_t... Idxs
>
80 requires requires
{ T
{AnyExcept
<I
, T
>{}}; }
91 static_assert(ConstructibleWithN
<Foo
>);
95 // GH60642 reported an assert being hit, make sure we don't assert.
97 template<auto Q
> concept C
= requires
{ Q
.template operator()<float>(); };
98 template<class> concept D
= true;
99 static_assert(C
<[]<D
>{}>); // ok
100 template<class> concept E
= C
<[]<D
>{}>;
101 static_assert(E
<int>); // previously Asserted.
103 // ensure we properly diagnose when "D" is false.
105 template<auto Q
> concept C
= requires
{ Q
.template operator()<float>(); };
106 template<class> concept D
= false;
107 static_assert(C
<[]<D
>{}>);
108 // expected-error@-1{{static assertion failed}}
109 // expected-note@-2{{does not satisfy 'C'}}
110 // expected-note@-5{{because 'Q.template operator()<float>()' would be invalid: no matching member function for call to 'operator()'}}
111 template<class> concept E
= C
<[]<D
>{}>;
112 static_assert(E
<int>);
113 // expected-error@-1{{static assertion failed}}
114 // expected-note@-2{{because 'int' does not satisfy 'E'}}
115 // expected-note@-4{{does not satisfy 'C'}}
116 // expected-note@-11{{because 'Q.template operator()<float>()' would be invalid: no matching member function for call to 'operator()'}}