aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/init.c
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2007-09-20 09:49:13 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2007-09-20 09:49:13 +0000
commitb43d1bdea541d54d36ad04c73ac8061c3ddec37a (patch)
tree8fac60f70b7df355e7fb34ee0b41f805877750cd /gcc/cp/init.c
parentc6f3019a9adcf8f5b788a50fc7500e73674c27f9 (diff)
downloadgcc-b43d1bdea541d54d36ad04c73ac8061c3ddec37a.zip
gcc-b43d1bdea541d54d36ad04c73ac8061c3ddec37a.tar.gz
gcc-b43d1bdea541d54d36ad04c73ac8061c3ddec37a.tar.bz2
re PR c++/33459 (ICE on reference member in union)
cp/ 2007-09-20 Paolo Carlini <pcarlini@suse.de> PR c++/33459 * init.c (build_zero_init): If, recursively, build_zero_init returns a NULL_TREE, do not append it to the VEC of constructors. testsuite/ 2007-09-20 Paolo Carlini <pcarlini@suse.de> PR c++/33459 * g++.dg/init/ref14.C: New. From-SVN: r128615
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r--gcc/cp/init.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index e11d184..247879c 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -136,11 +136,12 @@ initialize_vtbl_ptrs (tree addr)
/* Return an expression for the zero-initialization of an object with
type T. This expression will either be a constant (in the case
that T is a scalar), or a CONSTRUCTOR (in the case that T is an
- aggregate). In either case, the value can be used as DECL_INITIAL
- for a decl of the indicated TYPE; it is a valid static initializer.
- If NELTS is non-NULL, and TYPE is an ARRAY_TYPE, NELTS is the
- number of elements in the array. If STATIC_STORAGE_P is TRUE,
- initializers are only generated for entities for which
+ aggregate), or NULL (in the case that T does not require
+ initialization). In either case, the value can be used as
+ DECL_INITIAL for a decl of the indicated TYPE; it is a valid static
+ initializer. If NELTS is non-NULL, and TYPE is an ARRAY_TYPE, NELTS
+ is the number of elements in the array. If STATIC_STORAGE_P is
+ TRUE, initializers are only generated for entities for which
zero-initialization does not simply mean filling the storage with
zero bytes. */
@@ -199,7 +200,8 @@ build_zero_init (tree type, tree nelts, bool static_storage_p)
tree value = build_zero_init (TREE_TYPE (field),
/*nelts=*/NULL_TREE,
static_storage_p);
- CONSTRUCTOR_APPEND_ELT(v, field, value);
+ if (value)
+ CONSTRUCTOR_APPEND_ELT(v, field, value);
}
/* For unions, only the first field is initialized. */