diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2018-03-06 06:24:53 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2018-03-06 06:24:53 +0000 |
commit | 2e1a7ecb2d8f1ee3f88fd2906ab16eb30ab525f7 (patch) | |
tree | 5cd37847dde8ab2a0d1d2c4aa83f054104f46fc4 /gcc/cp | |
parent | 1ea71a82f9d42684c542147b231afb63e8a6da8f (diff) | |
download | gcc-2e1a7ecb2d8f1ee3f88fd2906ab16eb30ab525f7.zip gcc-2e1a7ecb2d8f1ee3f88fd2906ab16eb30ab525f7.tar.gz gcc-2e1a7ecb2d8f1ee3f88fd2906ab16eb30ab525f7.tar.bz2 |
[PR c++/84593] ice on braced init with uninit ref field
If an initializer expr is to be NULL in a ctor initializer list, we
ICE in picflag_from_initializer and elsewhere.
If we're missing an initializer for a reference field, we report the
error, but then build a zero initializer to avoid the ICE.
for gcc/cp/ChangeLog
PR c++/84593
* init.c (build_zero_init_1): Zero-initialize references.
for gcc/testsuite/ChangeLog
PR c++/84593
* g++.dg/cpp1y/pr84593.C: New.
From-SVN: r258270
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/init.c | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cbacda6..3623405 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2018-03-06 Alexandre Oliva <aoliva@redhat.com> + PR c++/84593 + * init.c (build_zero_init_1): Zero-initialize references. + PR c++/84492 * semantics.c (finish_stmt_expr_expr): Reject unresolved overloads used as stmt expr values. diff --git a/gcc/cp/init.c b/gcc/cp/init.c index d0d14ab..15cee17 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -284,7 +284,10 @@ build_zero_init_1 (tree type, tree nelts, bool static_storage_p, else if (VECTOR_TYPE_P (type)) init = build_zero_cst (type); else - gcc_assert (TREE_CODE (type) == REFERENCE_TYPE); + { + gcc_assert (TREE_CODE (type) == REFERENCE_TYPE); + init = build_zero_cst (type); + } /* In all cases, the initializer is a constant. */ if (init) |