| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++23 %s |
| 2 |
|
| 3 |
// expected-no-diagnostics |
| 4 |
|
| 5 |
namespace A { |
| 6 |
|
| 7 |
struct Foo { |
| 8 |
static int operator()(int a, int b) { return a + b; } |
| 9 |
static int operator[](int a, int b) { return a + b; } |
| 10 |
}; |
| 11 |
|
| 12 |
void ok() { |
| 13 |
// Should pass regardless of const / volatile |
| 14 |
Foo foo; |
| 15 |
foo(1, 2); |
| 16 |
foo[1, 2]; |
| 17 |
|
| 18 |
const Foo fooC; |
| 19 |
fooC(1, 2); |
| 20 |
fooC[1, 2]; |
| 21 |
|
| 22 |
const Foo fooV; |
| 23 |
fooV(1, 2); |
| 24 |
fooV[1, 2]; |
| 25 |
|
| 26 |
const volatile Foo fooCV; |
| 27 |
fooCV(1, 2); |
| 28 |
fooCV[1, 2]; |
| 29 |
} |
| 30 |
|
| 31 |
} |