32 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify -std=c++23 %s2 3// expected-no-diagnostics4 5namespace A {6 7struct 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 12void ok() {13 // Should pass regardless of const / volatile14 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}32