You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After accepted in Kona, update the code to accept static operator[] as well.
No big code changes: accept this operator as static in SemaDeclCXX, update AST call generation in SemaOverload and update feature macros + tests accordingly.
Reviewed By: cor3ntin, erichkeane, #clang-language-wg
Differential Revision: https://reviews.llvm.org/D138387
Copy file name to clipboardExpand all lines: clang/test/CXX/over/over.oper/p7.cpp
+7-2Lines changed: 7 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -5,14 +5,19 @@
5
5
6
6
structFunctor {
7
7
staticintoperator()(int a, int b);
8
-
// cxx11-warning@-1 {{is a C++2b extension}}
9
-
// precxx2b-warning@-2 {{declaring overloaded 'operator()' as 'static' is a C++2b extension}}
8
+
staticintoperator[](int a1);
9
+
// cxx11-warning@-2 {{declaring overloaded 'operator()' as 'static' is a C++2b extension}}
10
+
// cxx11-warning@-2 {{declaring overloaded 'operator[]' as 'static' is a C++2b extension}}
11
+
// precxx2b-warning@-4 {{incompatible with C++ standards before C++2b}}
12
+
// precxx2b-warning@-4 {{incompatible with C++ standards before C++2b}}
10
13
};
11
14
12
15
structInvalidParsing1 {
13
16
externintoperator()(int a, int b); // expected-error {{storage class specified}}
17
+
externintoperator[](int a1); // expected-error {{storage class specified}}
14
18
};
15
19
16
20
structInvalidParsing2 {
17
21
externstaticintoperator()(int a, int b); // expected-error {{storage class specified}} // expected-error {{cannot combine with previous 'extern' declaration specifier}}
22
+
externstaticintoperator[](int a); // expected-error {{storage class specified}} // expected-error {{cannot combine with previous 'extern' declaration specifier}}
0 commit comments