1 // RUN: %clang_cc1 -std=c++23 -verify -fsyntax-only %s
2 // This test case came up in the review of
3 // https://reviews.llvm.org/D159126
4 // when transforming `this` within a
5 // requires expression, we need to make sure
6 // the type of this (and its qualifiers) is respected.
8 // expected-no-diagnostics
12 concept __member_begin
= requires(_Tp __t
) {
18 requires __member_begin
<_Tp
>
19 auto operator()(_Tp
&&) {}
23 concept range
= requires
{
28 concept __can_compare_begin
= requires(_Tp __t
) {
33 template <__can_compare_begin _Tp
> void operator()(_Tp
&&);
36 template <range _Rp
> struct owning_view
{
39 void empty() const requires requires
{ empty(__r_
); };
43 concept HasEmpty
= requires(T t
) {
47 struct ComparableIters
{
51 static_assert(HasEmpty
<owning_view
<ComparableIters
&>>);
52 static_assert(HasEmpty
<owning_view
<ComparableIters
&&>>);
53 static_assert(!HasEmpty
<owning_view
<const ComparableIters
&>>);
54 static_assert(!HasEmpty
<owning_view
<const ComparableIters
&&>>);