diff options
author | Jakub Jelinek <jakub@redhat.com> | 2022-11-15 08:00:21 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2022-11-15 08:00:21 +0100 |
commit | 6492cec069bccf817ac5e984fb3eca407056a566 (patch) | |
tree | fefcbffd560982373a49d8a1a6b0b9c119bd20c6 /gcc/c-family/c-cppbuiltin.cc | |
parent | e0f4fcf9dfb8794a11d4ee63899b820aa9257f50 (diff) | |
download | gcc-6492cec069bccf817ac5e984fb3eca407056a566.zip gcc-6492cec069bccf817ac5e984fb3eca407056a566.tar.gz gcc-6492cec069bccf817ac5e984fb3eca407056a566.tar.bz2 |
c++: Implement C++23 P2589R1 - - static operator[]
Here is a patch that implements the static operator[] paper.
One thing that doesn't work properly is the same problem as I've filed
yesterday for static operator() - PR107624 - that side-effects of
the postfix-expression on which the call or subscript operator are
applied are thrown away, I assume we have to add them into COMPOUND_EXPR
somewhere after we find out that the we've chosen a static member function
operator.
2022-11-15 Jakub Jelinek <jakub@redhat.com>
gcc/c-family/
* c-cppbuiltin.cc (c_cpp_builtins): Bump C++23
__cpp_multidimensional_subscript macro value to 202211L.
gcc/cp/
* decl.cc (grok_op_properties): Implement C++23 P2589R1
- static operator[]. Handle operator[] similarly to operator()
- allow static member functions, but pedwarn on it for C++20 and
older. Unlike operator(), perform rest of checks on it though for
C++20.
* call.cc (add_operator_candidates): For operator[] with class
typed first parameter, pass that parameter as first_arg and
an adjusted arglist without that parameter.
gcc/testsuite/
* g++.dg/cpp23/subscript9.C: New test.
* g++.dg/cpp23/feat-cxx2b.C: Expect a newer
__cpp_multidimensional_subscript value.
* g++.old-deja/g++.bugs/900210_10.C: Don't expect an error
for C++23 or later.
Diffstat (limited to 'gcc/c-family/c-cppbuiltin.cc')
-rw-r--r-- | gcc/c-family/c-cppbuiltin.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc index cdb658f..f0be059 100644 --- a/gcc/c-family/c-cppbuiltin.cc +++ b/gcc/c-family/c-cppbuiltin.cc @@ -1075,7 +1075,7 @@ c_cpp_builtins (cpp_reader *pfile) cpp_define (pfile, "__cpp_size_t_suffix=202011L"); cpp_define (pfile, "__cpp_if_consteval=202106L"); cpp_define (pfile, "__cpp_constexpr=202110L"); - cpp_define (pfile, "__cpp_multidimensional_subscript=202110L"); + cpp_define (pfile, "__cpp_multidimensional_subscript=202211L"); cpp_define (pfile, "__cpp_named_character_escapes=202207L"); cpp_define (pfile, "__cpp_static_call_operator=202207L"); cpp_define (pfile, "__cpp_implicit_move=202207L"); |