From 81b4398d1e7f594c956213db39cf1b021561ef29 Mon Sep 17 00:00:00 2001 From: Adam Nemet Date: Thu, 27 May 2004 19:08:57 +0000 Subject: [PATCH] re PR c++/12883 (destructor of array object not called if no prior instantiation of the template has happened) 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 | 6 ++++++ gcc/cp/decl.c | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b2792808dbc..92b10d062d0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2004-05-27 Adam Nemet + + 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 * method.c (implicitly_declare_fn): Don't call defer_fn; abort diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index b666dd7105d..8a464beba68 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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. */ -- 2.30.2