diff options
author | Jason Merrill <jason@redhat.com> | 2014-07-14 01:25:19 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2014-07-14 01:25:19 -0400 |
commit | 7ce5ae457b6843015074781a5a4d76a3765b2c1c (patch) | |
tree | ae3b54f77942c5782039411c970c30549338b16a /gcc/cp | |
parent | 5806f7716ca0de830266dfbebca11e6919beb581 (diff) | |
download | gcc-7ce5ae457b6843015074781a5a4d76a3765b2c1c.zip gcc-7ce5ae457b6843015074781a5a4d76a3765b2c1c.tar.gz gcc-7ce5ae457b6843015074781a5a4d76a3765b2c1c.tar.bz2 |
re PR c++/60628 ([c++11] ICE initializing array of auto)
PR c++/60628
* decl.c (create_array_type_for_decl): Only check for auto once.
From-SVN: r212504
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/decl.c | 16 |
2 files changed, 8 insertions, 11 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bdad6d9..45116eb 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2014-07-13 Jason Merrill <jason@redhat.com> + PR c++/60628 + * decl.c (create_array_type_for_decl): Only check for auto once. + PR c++/58636 * call.c (build_list_conv): Don't try to build a list of references. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index dae85c2..8f829d0 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8540,9 +8540,11 @@ create_array_type_for_decl (tree name, tree type, tree size) /* 8.3.4/1: If the type of the identifier of D contains the auto type-specifier, the program is ill-formed. */ - if (pedantic && type_uses_auto (type)) - pedwarn (input_location, OPT_Wpedantic, - "declaration of %qD as array of %<auto%>", name); + if (type_uses_auto (type)) + { + error ("%qD declared as array of %qT", name, type); + return error_mark_node; + } /* If there are some types which cannot be array elements, issue an error-message and return. */ @@ -8601,14 +8603,6 @@ 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); |