Hi! On Thu, Oct 14, 2021 at 10:26:29AM +0200, Jakub Jelinek via Gcc-patches wrote: > The following patch implements the C++23 Multidimensional subscript operator > P2128R6 paper.
I'd like to ping this patch. Thanks. > 2021-10-14 Jakub Jelinek <ja...@redhat.com> > > PR c++/102611 > gcc/ > * doc/invoke.texi (-Wcomma-subscript): Document that for > -std=c++20 the option isn't enabled by default with -Wno-deprecated > but for -std=c++23 it is. > gcc/c-family/ > * c-opts.c (c_common_post_options): Enable -Wcomma-subscript by > default for C++23 regardless of warn_deprecated. > * c-cppbuiltin.c (c_cpp_builtins): Predefine > __cpp_multidimensional_subscript=202110L for C++23. > gcc/cp/ > * cp-tree.h (build_op_subscript): Implement P2128R6 > - Multidimensional subscript operator. Declare. > (grok_array_decl): Remove bool argument, add vec<tree, va_gc> ** > and tsubst_flags_t arguments. > (build_min_non_dep_op_overload): Declare another overload. > * parser.c (cp_parser_postfix_expression): Mention C++23 syntax > in function comment. For C++23 parse zero or more than one > initializer clauses in expression list, adjust grok_array_decl > caller. > (cp_parser_builtin_offsetof): Adjust grok_array_decl caller. > * decl.c (grok_op_properties): For C++23 don't check number > of arguments of operator[]. > * decl2.c (grok_array_decl): Remove decltype_p argument, add > index_exp_list and complain arguments. If index_exp is NULL, > handle *index_exp_list as the subscript expression list. > * tree.c (build_min_non_dep_op_overload): New overload. > * call.c (build_op_subscript_1, build_op_subscript): New > functions. > * pt.c (tsubst_copy_and_build) <case ARRAY_REF>: If second > operand is magic CALL_EXPR with ovl_op_identifier (ARRAY_REF) > as CALL_EXPR_FN, tsubst CALL_EXPR arguments including expanding > pack expressions in it and call grok_array_decl instead of > build_x_array_ref. > * semantics.c (handle_omp_array_sections_1): Adjust grok_array_decl > caller. > gcc/testsuite/ > * g++.dg/cpp2a/comma1.C: Expect different diagnostics for C++23. > * g++.dg/cpp2a/comma3.C: Likewise. > * g++.dg/cpp2a/comma4.C: Expect diagnostics for C++23. > * g++.dg/cpp2a/comma5.C: Expect different diagnostics for C++23. > * g++.dg/cpp23/feat-cxx2b.C: Test __cpp_multidimensional_subscript > predefined macro. > * g++.dg/cpp23/subscript1.C: New test. > * g++.dg/cpp23/subscript2.C: New test. > * g++.dg/cpp23/subscript3.C: New test. > * g++.dg/cpp23/subscript4.C: New test. > * g++.dg/cpp23/subscript5.C: New test. > * g++.dg/cpp23/subscript6.C: New test. Jakub