diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-10-17 07:40:35 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-10-17 07:40:35 +0000 |
commit | 149919c6ea55b51c2b97df0321c02bdbf673a954 (patch) | |
tree | 8e6d7857b740bd5898ac397f351e073b552192a9 /gcc/cp/init.c | |
parent | dd9c59f6288e8d6a8f780e433dde4d01387e6d62 (diff) | |
download | gcc-149919c6ea55b51c2b97df0321c02bdbf673a954.tar.gz |
* init.c (expand_default_init): Handle brace-enclosed initializers
correctly.
* g++.dg/init/array8.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@58245 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r-- | gcc/cp/init.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 3e71e9f1a86..a7db6267853 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -1181,17 +1181,12 @@ expand_default_init (binfo, true_exp, exp, init, flags) to run a new constructor; and catching an exception, where we have already built up the constructor call so we could wrap it in an exception region. */; - else if (TREE_CODE (init) == CONSTRUCTOR) + else if (TREE_CODE (init) == CONSTRUCTOR + && TREE_HAS_CONSTRUCTOR (init)) { - if (!TYPE_HAS_CONSTRUCTOR (type)) - /* A brace-enclosed initializer has whatever type is - required. There's no need to convert it. */ - ; - else - init = ocp_convert (type, - TREE_VALUE (CONSTRUCTOR_ELTS (init)), - CONV_IMPLICIT | CONV_FORCE_TEMP, - flags); + /* A brace-enclosed initializer for an aggregate. */ + my_friendly_assert (CP_AGGREGATE_TYPE_P (type), 20021016); + init = digest_init (type, init, (tree *)NULL); } else init = ocp_convert (type, init, CONV_IMPLICIT|CONV_FORCE_TEMP, flags); |