1 // RUN: %clang_cc1 -fsyntax-only -std=c++2b %s -verify
2 // RUN: %clang_cc1 -fsyntax-only -std=c++2b %s -verify -fexperimental-new-constant-interpreter
3 // expected-no-diagnostics
5 template <typename Base
>
11 constexpr int f(this const S
&) {
14 constexpr int f(this const S
&, auto&&... args
) {
15 return (args
+ ... + 0);
17 constexpr int operator[](this const S
&) {
20 constexpr int operator[](this const S
& self
, int i
) {
23 constexpr int operator()(this const S
&) {
26 constexpr int operator()(this const S
& self
, int i
) {
29 constexpr bool operator==(this const S
& self
, auto && test
) {
30 return self
.base
== test
;
32 constexpr int operator*(this const S
& self
) {
33 return self
.base
+ 22;
35 constexpr operator Wrap
<S
> (this const S
& self
) {
38 constexpr int operator <<(this Wrap
<S
> self
, int i
) {
45 consteval
void test() {
47 static_assert(s
.f() == 42);
48 static_assert(s
[] == 42);
49 static_assert(s
[22] == 42);
50 static_assert(s
.f() == 42);
51 static_assert(s() == 42);
52 static_assert(s(22) == 42);
53 static_assert(s
== 20);
54 static_assert(s
!= 0);
55 static_assert(*s
== 42);
56 static_assert((s
<< 11) == 31);
61 constexpr auto f
= [x
= 3]<typename Self
>(this Self
&& self
) {
65 auto g
= [x
= 3]<typename Self
>(this Self
&& self
) {
70 constexpr int a
= f();
71 static_assert(a
== 3);