1 // RUN: %clang_cc1 -fsyntax-only -std=c++2b %s -verify
2 // expected-no-diagnostics
4 template <typename Base
>
10 constexpr int f(this const S
&) {
13 constexpr int f(this const S
&, auto&&... args
) {
14 return (args
+ ... + 0);
16 constexpr int operator[](this const S
&) {
19 constexpr int operator[](this const S
& self
, int i
) {
22 constexpr int operator()(this const S
&) {
25 constexpr int operator()(this const S
& self
, int i
) {
28 constexpr bool operator==(this const S
& self
, auto && test
) {
29 return self
.base
== test
;
31 constexpr int operator*(this const S
& self
) {
32 return self
.base
+ 22;
34 constexpr operator Wrap
<S
> (this const S
& self
) {
37 constexpr int operator <<(this Wrap
<S
> self
, int i
) {
44 consteval
void test() {
46 static_assert(s
.f() == 42);
47 static_assert(s
[] == 42);
48 static_assert(s
[22] == 42);
49 static_assert(s
.f() == 42);
50 static_assert(s() == 42);
51 static_assert(s(22) == 42);
52 static_assert(s
== 20);
53 static_assert(s
!= 0);
54 static_assert(*s
== 42);
55 static_assert((s
<< 11) == 31);
60 constexpr auto f
= [x
= 3]<typename Self
>(this Self
&& self
) {
64 auto g
= [x
= 3]<typename Self
>(this Self
&& self
) {
69 constexpr int a
= f();
70 static_assert(a
== 3);