diff options
author | Patrick Palka <ppalka@redhat.com> | 2021-04-16 09:24:46 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2021-04-16 09:24:46 -0400 |
commit | baf05d54dc919c968d12de9d049e36e5bac10dec (patch) | |
tree | 27466678b6db6aec3db06272c99efde1b6a2b651 /gcc/fortran/module.c | |
parent | 47f42744f6e10ad41db926d739306e6f237fd3ac (diff) | |
download | gcc-baf05d54dc919c968d12de9d049e36e5bac10dec.zip gcc-baf05d54dc919c968d12de9d049e36e5bac10dec.tar.gz gcc-baf05d54dc919c968d12de9d049e36e5bac10dec.tar.bz2 |
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.
Diffstat (limited to 'gcc/fortran/module.c')
0 files changed, 0 insertions, 0 deletions