aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-03-25 14:00:30 -0400
committerJason Merrill <jason@gcc.gnu.org>2014-03-25 14:00:30 -0400
commit45156f1474c97ecc7147951b36714fe4655676af (patch)
tree7ef9d1aa0216bac5203cee9916212771802c64fb
parent3102858dbae01e409177f79d118395b6ad1946cc (diff)
downloadgcc-45156f1474c97ecc7147951b36714fe4655676af.zip
gcc-45156f1474c97ecc7147951b36714fe4655676af.tar.gz
gcc-45156f1474c97ecc7147951b36714fe4655676af.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl.c8
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/auto42.C9
3 files changed, 22 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a5a3695..47c9890 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index c912ffc..f3a081b 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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);
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto42.C b/gcc/testsuite/g++.dg/cpp0x/auto42.C
new file mode 100644
index 0000000..fea4c28
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/auto42.C
@@ -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" }
+}