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

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jason Merrill
<ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:3c10dc751e8670c7cc02a1b6db9abffb59d2fc42

commit r11-10042-g3c10dc751e8670c7cc02a1b6db9abffb59d2fc42
Author: Jason Merrill <ja...@redhat.com>
Date:   Tue Apr 26 11:15:04 2022 -0400

    c++: constexpr ref to array of array [PR102307]

    The problem here is that first check_initializer calls
    build_aggr_init_full_exprs, which does overload resolution, but then in the
    case of failed constexpr throws away the result and does it again in
    build_functional_cast.  But in the first overload resolution,
    reshape_init_array_1 decided to reuse the inner CONSTRUCTORs because
    tf_error is set, so we know we're committed.  But the second pass gets
    confused by the CONSTRUCTORs with non-init-list types.

    Fixed by avoiding a second pass: instead, pass the call from
build_aggr_init
    to build_cplus_new, which will turn it into a TARGET_EXPR.  I don't bother
    to change the object argument because it will be replaced later in
    simplify_aggr_init_expr.

            PR c++/102307

    gcc/cp/ChangeLog:

            * decl.c (check_initializer): Use build_cplus_new in case of
            constexpr failure.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1z/constexpr-array2.C: New test.
  • [Bug c++/102307] [10/11 Regress... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to