]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cp-tree.h (CP_AGGREGATE_TYPE_P): Accept vectors.
authorAldy Hernandez <aldyh@redhat.com>
Fri, 30 Jan 2004 00:41:08 +0000 (00:41 +0000)
committerAldy Hernandez <aldyh@gcc.gnu.org>
Fri, 30 Jan 2004 00:41:08 +0000 (00:41 +0000)
        * cp/cp-tree.h (CP_AGGREGATE_TYPE_P): Accept vectors.

        * cp/decl.c (reshape_init): Handle vectors.

        * testsuite/g++.dg/init/array10.C: New.

From-SVN: r76913

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c

index b7511b3d914f28252bcde95e0335f34ce2266645..d6368f4b484e6fabd3e762ad83d4f264f34be877 100644 (file)
@@ -1,3 +1,14 @@
+2004-01-29  Aldy Hernandez  <aldyh@redhat.com>
+
+       Backport:
+       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.
+
 2004-01-25  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
 
        PR c++/13797
index dcff3e95df52318124a684f05b4f63e5c3a365d2..b97520baecac2b6ed586d0e50fb68e55a17dbe5b 100644 (file)
@@ -2546,9 +2546,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)))
 
index 6dda5dbbd3112ea9bb4421493593f27d1c55f4f2..cbf6d0c40738892fdbffd38086bd87a678432080 100644 (file)
@@ -8240,7 +8240,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);
@@ -8285,8 +8286,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);