[Bug c++/103460] GCC rejected operator[](auto[]...) after P2128

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 10 14:28:56 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103460

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:e46843ff75c37c705811e0c13bb469eda13b5f6c

commit r12-7598-ge46843ff75c37c705811e0c13bb469eda13b5f6c
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Mar 10 15:28:20 2022 +0100

    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.


More information about the Gcc-bugs mailing list