re PR c++/12883 (destructor of array object not called if no prior instantiation...
authorAdam Nemet <anemet@lnxw.com>
Thu, 27 May 2004 19:08:57 +0000 (19:08 +0000)
committerAdam Nemet <nemet@gcc.gnu.org>
Thu, 27 May 2004 19:08:57 +0000 (19:08 +0000)
PR c++/12883
* decl.c (complete_array_type): Set TYPE_NEEDS_CONSTRUCTING and
TYPE_HAS_NONTRIVIAL_DESTRUCTOR based on the underlying type.

From-SVN: r82333

gcc/cp/ChangeLog
gcc/cp/decl.c

index b2792808dbca8a9749f000277cf815370c9231bf..92b10d062d0cac1f306020d83054ca9faeb11153 100644 (file)
@@ -1,3 +1,9 @@
+2004-05-27  Adam Nemet  <anemet@lnxw.com>
+
+       PR c++/12883
+       * decl.c (complete_array_type): Set TYPE_NEEDS_CONSTRUCTING and
+       TYPE_HAS_NONTRIVIAL_DESTRUCTOR based on the underlying type.
+
 2004-05-24  Geoffrey Keating  <geoffk@apple.com>
 
        * method.c (implicitly_declare_fn): Don't call defer_fn; abort
index b666dd7105d3f49f0b538372e88864ac28acec41..8a464beba6870492a41c8f0003e06f277134f481 100644 (file)
@@ -5337,6 +5337,7 @@ complete_array_type (tree type, tree initial_value, int do_default)
     {
       tree itype;
       tree domain;
+      tree elt_type;
 
       domain = build_index_type (maxindex);
       TYPE_DOMAIN (type) = domain;
@@ -5354,6 +5355,12 @@ complete_array_type (tree type, tree initial_value, int do_default)
         size of the array.  */
       if (! TYPE_DOMAIN (TYPE_MAIN_VARIANT (type)))
        TYPE_DOMAIN (TYPE_MAIN_VARIANT (type)) = domain;
+
+      elt_type = TREE_TYPE (type);
+      TYPE_NEEDS_CONSTRUCTING (type)
+       = TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (elt_type));
+      TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
+       = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TYPE_MAIN_VARIANT (elt_type));      
     }
 
   /* Lay out the type now that we can get the real answer.  */