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

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

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

commit r13-6946-gc016887c91a79d67b6a3c7e19b9219f5ab1e2a4d
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Thu Mar 30 23:08:25 2023 +0200

    c++: Fix up ICE in build_min_non_dep_op_overload [PR109319]

    The following testcase ICEs, because grok_array_decl during
    processing_template_decl handling of a non-dependent subscript
    emits a -Wcomma-subscript pedwarn, we decide to pass to the
    single index argument the index expressions as if it was wrapped
    with () around it, but then when preparing it for later instantiation
    we don't actually take that into account and ICE on a mismatch of
    number of index arguments (the overload expects a single index,
    testcase has two index expressions in this case).
    For non-dependent subscript which are builtin subscripts we also
    emit the same pedwarn and don't ICE, but emit the same pedwarn
    again whenever we instantiate it, which is also IMHO undesirable,
    it is enough to warn once during parsing the template.

    The following patch fixes it by turning even the original index expressions
    (those which didn't go through make_args_non_dependent) into a single
    index using comma expression(s).

    2023-03-30  Jakub Jelinek  <ja...@redhat.com>

            PR c++/109319
            * decl2.cc (grok_array_decl): After emitting a pedwarn for
            -Wcomma-subscript, if processing_template_decl set orig_index_exp
            to compound expr from orig_index_exp_list.

            * g++.dg/cpp23/subscript14.C: New test.

Reply via email to