summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-04 01:06:09 +0000
committeraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-04 01:06:09 +0000
commit5264d007cf9d80b76e06c0397074c6150387438c (patch)
tree6c55475f3504ad73657d3bc408dacdb1bfec650f
parentfd6a4bf6ce39cdb8f60fbec395c01087f7d2b64c (diff)
downloadgcc-5264d007cf9d80b76e06c0397074c6150387438c.tar.gz
2003-06-03 Jason Merrill <jason@redhat.com>
* cp/cp-tree.h (CP_AGGREGATE_TYPE_P): Accept vectors. * cp/decl.c (reshape_init): Handle vectors. * testsuite/g++.dg/init/array10.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67414 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/cp-tree.h5
-rw-r--r--gcc/cp/decl.c6
3 files changed, 15 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 158db739a84..24e4f77f94e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+2003-06-03 Jason Merrill <jason@redhat.com>
+
+ * cp/cp-tree.h (CP_AGGREGATE_TYPE_P): Accept vectors.
+
+ * cp/decl.c (reshape_init): Handle vectors.
+
+ * testsuite/g++.dg/init/array10.C: New.
+
2003-06-03 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/10940
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 0fecbea9929..b72fb1787f3 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -2397,9 +2397,12 @@ struct lang_decl GTY(())
An aggregate is an array or a class with no user-declared
constructors, no private or protected non-static data members, no
- base classes, and no virtual functions. */
+ base classes, and no virtual functions.
+
+ As an extension, we also treat vectors as aggregates. */
#define CP_AGGREGATE_TYPE_P(TYPE) \
(TREE_CODE (TYPE) == ARRAY_TYPE \
+ || TREE_CODE (TYPE) == VECTOR_TYPE \
|| (CLASS_TYPE_P (TYPE) \
&& !CLASSTYPE_NON_AGGREGATE (TYPE)))
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 4355df5b6be..705f5a07cd9 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -7438,7 +7438,8 @@ reshape_init (tree type, tree *initp)
/* If the initializer is brace-enclosed, pull initializers from the
enclosed elements. Advance past the brace-enclosed initializer
now. */
- if (TREE_CODE (old_init_value) == CONSTRUCTOR
+ if (TREE_CODE (old_init_value) == CONSTRUCTOR
+ && TREE_TYPE (old_init_value) == NULL_TREE
&& TREE_HAS_CONSTRUCTOR (old_init_value))
{
*initp = TREE_CHAIN (old_init);
@@ -7483,8 +7484,7 @@ reshape_init (tree type, tree *initp)
non-empty subaggregate, brace elision is assumed and the
initializer is considered for the initialization of the first
member of the subaggregate. */
- if (CLASS_TYPE_P (type)
- && !brace_enclosed_p
+ if (!brace_enclosed_p
&& can_convert_arg (type, TREE_TYPE (old_init_value), old_init_value))
{
*initp = TREE_CHAIN (old_init);