aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-01-24 14:05:39 -0500
committerJason Merrill <jason@gcc.gnu.org>2014-01-24 14:05:39 -0500
commit233aedf4c30248e5504afca2e421e22c3b33c96c (patch)
treef9d2ad06297869f82286090cc8d939703bd5f482 /gcc
parent4bcfd75c0331c8e291316e5e1b7ee668479d60b1 (diff)
downloadgcc-233aedf4c30248e5504afca2e421e22c3b33c96c.zip
gcc-233aedf4c30248e5504afca2e421e22c3b33c96c.tar.gz
gcc-233aedf4c30248e5504afca2e421e22c3b33c96c.tar.bz2
re PR c++/58550 (][c++11] ICE with auto in function return type and lto)
PR c++/58550 * decl.c (grokdeclarator): Turn pedwarn about auto return type in c++11 into error. From-SVN: r207055
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/decl.c7
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/auto41.C5
3 files changed, 15 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4485108..52394b3 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2014-01-24 Jason Merrill <jason@redhat.com>
+ PR c++/58550
+ * decl.c (grokdeclarator): Turn pedwarn about auto return type in
+ c++11 into error.
+
PR c++/59886
PR c++/59659
* typeck2.c (process_init_constructor_array): Don't create
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index f4819a6..aaafaa8 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -9599,9 +9599,14 @@ grokdeclarator (const cp_declarator *declarator,
&& LAMBDA_TYPE_P (current_class_type))
/* OK for C++11 lambdas. */;
else if (cxx_dialect < cxx1y)
- pedwarn (input_location, 0, "%qs function uses "
+ {
+ error ("%qs function uses "
"%<auto%> type specifier without trailing "
"return type", name);
+ inform (input_location, "deduced return type "
+ "only available with -std=c++1y or "
+ "-std=gnu++1y");
+ }
else if (virtualp)
permerror (input_location, "virtual function cannot "
"have deduced return type");
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto41.C b/gcc/testsuite/g++.dg/cpp0x/auto41.C
new file mode 100644
index 0000000..6f102e7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/auto41.C
@@ -0,0 +1,5 @@
+// PR c++/58550
+// { dg-options "-std=c++11" }
+
+auto foo(); // { dg-error "auto" }
+auto fp = foo;