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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>:

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

commit r11-8216-gbaf05d54dc919c968d12de9d049e36e5bac10dec
Author: Patrick Palka <ppa...@redhat.com>
Date:   Fri Apr 16 09:24:46 2021 -0400

    c++: partially initialized constexpr array [PR99700]

    Here, reduced_constant_expression_p is incorrectly returning true for a
    partially initialized array CONSTRUCTOR (in C++20 mode) because when the
    CONSTRUCTOR_NO_CLEARING flag is set, the predicate doesn't check that
    the CONSTRUCTOR spans the entire array like it does for class CONSTRUCTORS.
    This patch adds a dedicated loop for the array case that simultaneously
    verifies the CONSTRUCTOR spans the entire array and is made up of valid
    constant expressions.

    gcc/cp/ChangeLog:

            PR c++/99700
            * constexpr.c (reduced_constant_expression_p): For array
            CONSTRUCTORs, use a dedicated loop that additionally verifies
            the CONSTRUCTOR spans the entire array.

    gcc/testsuite/ChangeLog:

            PR c++/99700
            * g++.dg/cpp2a/constexpr-init21.C: New test.

Reply via email to