Commit fe5b6c1c by Richard Sandiford Committed by Richard Sandiford

decl.c (check_initializer): Try to complete the type of an array element before…

decl.c (check_initializer): Try to complete the type of an array element before checking whether it's complete.

        * 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.

From-SVN: r47008
parent b1bba9c0
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> 2001-11-14 Joseph S. Myers <jsm28@cam.ac.uk>
* Make-lang.in: Change all uses of $(manext) to $(man1ext). * Make-lang.in: Change all uses of $(manext) to $(man1ext).
......
...@@ -7709,12 +7709,12 @@ check_initializer (decl, init) ...@@ -7709,12 +7709,12 @@ check_initializer (decl, init)
init = NULL_TREE; init = NULL_TREE;
} }
else if (TREE_CODE (type) == ARRAY_TYPE 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); cp_error ("elements of array `%#D' have incomplete type", decl);
init = NULL_TREE; 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); cp_error ("`%D' has incomplete type", decl);
TREE_TYPE (decl) = error_mark_node; TREE_TYPE (decl) = error_mark_node;
...@@ -8154,8 +8154,8 @@ cp_finish_decl (decl, init, asmspec_tree, flags) ...@@ -8154,8 +8154,8 @@ cp_finish_decl (decl, init, asmspec_tree, flags)
} }
/* Deduce size of array from initialization, if not already known. */ /* Deduce size of array from initialization, if not already known. */
maybe_deduce_size_from_array_init (decl, init);
init = check_initializer (decl, init); init = check_initializer (decl, init);
maybe_deduce_size_from_array_init (decl, init);
GNU_xref_decl (current_function_decl, decl); GNU_xref_decl (current_function_decl, decl);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment