brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 9d1201a Raw
24 lines · cpp
1// RUN: %clang_cc1 -std=c++11 %s -verify=expected,cxx112// RUN: %clang_cc1 -std=c++23 %s -verify=expected,cxx233// RUN: %clang_cc1 -std=c++23 -Wpre-c++23-compat %s -verify=expected,precxx234 5 6struct Functor {7  static int operator()(int a, int b);8  static int operator[](int a1);9  // cxx11-warning@-2 {{declaring overloaded 'operator()' as 'static' is a C++23 extension}}10  // cxx11-warning@-2 {{declaring overloaded 'operator[]' as 'static' is a C++23 extension}}11  // precxx23-warning@-4 {{incompatible with C++ standards before C++23}}12  // precxx23-warning@-4 {{incompatible with C++ standards before C++23}}13};14 15struct InvalidParsing1 {16  extern int operator()(int a, int b);  // expected-error {{storage class specified}}17  extern int operator[](int a1);  // expected-error {{storage class specified}}18};19 20struct InvalidParsing2 {21  extern static int operator()(int a, int b);  // expected-error {{storage class specified}} // expected-error {{cannot combine with previous 'extern' declaration specifier}}22  extern static int operator[](int a);  // expected-error {{storage class specified}} // expected-error {{cannot combine with previous 'extern' declaration specifier}}23};24