decl.c (create_array_type_for_decl): Check if NAME is NULL_TREE when displaying error message about missing array bounds.

* decl.c (create_array_type_for_decl): Check if NAME is NULL_TREE
	when displaying error message about missing array bounds.

From-SVN: r47136
This commit is contained in:
Kriang Lerdsuwanakij 2001-11-18 06:31:20 +00:00 committed by Kriang Lerdsuwanakij
parent 873ff98777
commit b3faacfdd4
3 changed files with 20 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2001-11-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
* decl.c (create_array_type_for_decl): Check if NAME is NULL_TREE
when displaying error message about missing array bounds.
2001-11-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
* mangle.c (write_expression): Handle CAST_EXPR, STATIC_CAST_EXPR,

View file

@ -9476,8 +9476,11 @@ create_array_type_for_decl (name, type, size)
can be omitted only for the first member of the sequence. */
if (TREE_CODE (type) == ARRAY_TYPE && !TYPE_DOMAIN (type))
{
cp_error ("declaration of `%D' as multidimensional array must have bounds for all dimensions except the first",
name);
if (name)
cp_error ("declaration of `%D' as multidimensional array must have bounds for all dimensions except the first",
name);
else
cp_error ("multidimensional array must have bounds for all dimensions except the first");
return error_mark_node;
}

View file

@ -0,0 +1,10 @@
// Test typeid of multidimensional array with no bounds.
// { dg-do compile }
#include <typeinfo>
int main()
{
const char *s = typeid(double[][]).name(); // { dg-error "bounds|confused" }
return 0;
}