diff options
author | Jason Merrill <jason@redhat.com> | 2020-12-22 16:40:37 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2020-12-23 16:40:17 -0500 |
commit | 6b7d53a25933f4aed71d6d5134e971bd995f8973 (patch) | |
tree | b407f4eb8227d21074b79e8a5b662632634fd745 /gcc/cp/parser.c | |
parent | 96de87b99bf8fd1c46df373bbcc2f7d76db716ad (diff) | |
download | gcc-6b7d53a25933f4aed71d6d5134e971bd995f8973.zip gcc-6b7d53a25933f4aed71d6d5134e971bd995f8973.tar.gz gcc-6b7d53a25933f4aed71d6d5134e971bd995f8973.tar.bz2 |
c++: Fix constexpr array ICE [PR98332]
The element initializer was non-constant, so its CONSTRUCTOR element ended
up NULL, so unshare_constructor crashed trying to look at it. This patch
fixes this in two places: First, by returning when we see a non-constant
initializer; second, by not crashing on NULL.
gcc/cp/ChangeLog:
PR c++/98332
* constexpr.c (unshare_constructor): Check for NULL.
(cxx_eval_vec_init_1): Always exit early if non-constant.
gcc/testsuite/ChangeLog:
PR c++/98332
* g++.dg/cpp0x/constexpr-overflow3.C: New test.
Diffstat (limited to 'gcc/cp/parser.c')
0 files changed, 0 insertions, 0 deletions