re PR c++/60628 ([c++11] ICE initializing array of auto)
PR c++/60628 * decl.c (create_array_type_for_decl): Complain about array of auto. From-SVN: r208816
This commit is contained in:
parent
3102858dba
commit
45156f1474
@ -1,3 +1,8 @@
|
||||
2014-03-25 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/60628
|
||||
* decl.c (create_array_type_for_decl): Complain about array of auto.
|
||||
|
||||
2014-03-25 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/60331
|
||||
|
@ -8534,6 +8534,14 @@ create_array_type_for_decl (tree name, tree type, tree size)
|
||||
&& (flag_iso || warn_vla > 0))
|
||||
pedwarn (input_location, OPT_Wvla, "array of array of runtime bound");
|
||||
|
||||
/* 8.3.4p1: ...if the type of the identifier of D contains the auto
|
||||
type-specifier, the program is ill-formed. */
|
||||
if (type_uses_auto (type))
|
||||
{
|
||||
error ("%qD declared as array of %qT", name, type);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
/* Figure out the index type for the array. */
|
||||
if (size)
|
||||
itype = compute_array_index_type (name, size, tf_warning_or_error);
|
||||
|
9
gcc/testsuite/g++.dg/cpp0x/auto42.C
Normal file
9
gcc/testsuite/g++.dg/cpp0x/auto42.C
Normal file
@ -0,0 +1,9 @@
|
||||
// PR c++/60628
|
||||
// { dg-do compile { target c++11 } }
|
||||
|
||||
#include <initializer_list>
|
||||
|
||||
void foo(int i)
|
||||
{
|
||||
auto x[1] = { 0 }; // { dg-error "array of .auto" }
|
||||
}
|
Loading…
Reference in New Issue
Block a user