summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2001-11-14 12:53:09 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2001-11-14 12:53:09 +0000
commit99bd978531b2d5db0c836af72db32ad48b265e3d (patch)
tree116ca930c48210e644eea48ac68af51c8a8e845c
parentd244d0194da7c7a10bdef29968648700436141c8 (diff)
downloadppe42-gcc-99bd978531b2d5db0c836af72db32ad48b265e3d.tar.gz
ppe42-gcc-99bd978531b2d5db0c836af72db32ad48b265e3d.zip
* decl.c (check_initializer): Try to complete the type of an
array element before checking whether it's complete. Don't complain about arrays with complete element types but an unknown size. (cp_finish_decl): Build the hierarchical constructor before calling maybe_deduce_size_from_array_init. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@47008 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/decl.c6
2 files changed, 12 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0454d024b09..5717f57bb46 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+2001-11-14 Richard Sandiford <rsandifo@redhat.com>
+
+ * decl.c (check_initializer): Try to complete the type of an
+ array element before checking whether it's complete. Don't
+ complain about arrays with complete element types but an
+ unknown size.
+ (cp_finish_decl): Build the hierarchical constructor before
+ calling maybe_deduce_size_from_array_init.
+
2001-11-14 Joseph S. Myers <jsm28@cam.ac.uk>
* Make-lang.in: Change all uses of $(manext) to $(man1ext).
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index a210a7b830f..39708f9114b 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -7709,12 +7709,12 @@ check_initializer (decl, init)
init = NULL_TREE;
}
else if (TREE_CODE (type) == ARRAY_TYPE
- && !COMPLETE_TYPE_P (TREE_TYPE (type)))
+ && !COMPLETE_TYPE_P (complete_type (TREE_TYPE (type))))
{
cp_error ("elements of array `%#D' have incomplete type", decl);
init = NULL_TREE;
}
- else if (!COMPLETE_TYPE_P (type))
+ else if (TREE_CODE (type) != ARRAY_TYPE && !COMPLETE_TYPE_P (type))
{
cp_error ("`%D' has incomplete type", decl);
TREE_TYPE (decl) = error_mark_node;
@@ -8154,8 +8154,8 @@ cp_finish_decl (decl, init, asmspec_tree, flags)
}
/* Deduce size of array from initialization, if not already known. */
- maybe_deduce_size_from_array_init (decl, init);
init = check_initializer (decl, init);
+ maybe_deduce_size_from_array_init (decl, init);
GNU_xref_decl (current_function_decl, decl);
OpenPOWER on IntegriCloud