c++: allow variadic operator[] for C++23 [PR103460]
authorJakub Jelinek <jakub@redhat.com>
Thu, 10 Mar 2022 14:28:20 +0000 (15:28 +0100)
committerJakub Jelinek <jakub@redhat.com>
Thu, 10 Mar 2022 14:28:20 +0000 (15:28 +0100)
commite46843ff75c37c705811e0c13bb469eda13b5f6c
treeb279306be150968e01687be58134f8c99d625e1d
parent73f3b8a53e6664c079731c2a183c16621481d039
c++: allow variadic operator[] for C++23 [PR103460]

wg21.link/p2128 removed "with exactly one parameter" from over.sub
section.  grok_op_properties has for that the last 2 lines in:
    case OVL_OP_FLAG_BINARY:
      if (arity != 2)
        {
          if (operator_code == ARRAY_REF && cxx_dialect >= cxx23)
            break;
but unfortunately it isn't enough, we reject variadic operator[]
earlier.  The following patch accepts variadic operator[] for C++23
too.

2022-03-10  Jakub Jelinek  <jakub@redhat.com>

PR c++/103460
* decl.cc (grok_op_properties): Allow variadic operator[] for
C++23.

* g++.dg/cpp23/subscript7.C: New test.
gcc/cp/decl.cc
gcc/testsuite/g++.dg/cpp23/subscript7.C [new file with mode: 0644]