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:
parent
873ff98777
commit
b3faacfdd4
3 changed files with 20 additions and 2 deletions
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
10
gcc/testsuite/g++.dg/other/array1.C
Normal file
10
gcc/testsuite/g++.dg/other/array1.C
Normal 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;
|
||||
}
|
Loading…
Add table
Reference in a new issue