Author: Jakub Jelinek <firstname.lastname@example.org>
Date: Tue Nov 15 08:00:21 2022 +0100
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
2022-11-15 Jakub Jelinek <email@example.com>
* c-cppbuiltin.cc (c_cpp_builtins): Bump C++23
__cpp_multidimensional_subscript macro value to 202211L.
* 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
* 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.
* g++.dg/cpp23/subscript9.C: New test.
* g++.dg/cpp23/feat-cxx2b.C: Expect a newer
* g++.old-deja/g++.bugs/900210_10.C: Don't expect an error
for C++23 or later.