aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-03-24 11:55:43 -0400
committerJason Merrill <jason@gcc.gnu.org>2014-03-24 11:55:43 -0400
commitd0f27fb6b3759484cb51088ee362aeb04df68fde (patch)
treec0778a38e4eb92342f0f05984301d8292bd67b46
parent739d9ab5052d504d443e763d4170fd152ea3a5a0 (diff)
downloadgcc-d0f27fb6b3759484cb51088ee362aeb04df68fde.zip
gcc-d0f27fb6b3759484cb51088ee362aeb04df68fde.tar.gz
gcc-d0f27fb6b3759484cb51088ee362aeb04df68fde.tar.bz2
re PR c++/60574 ([c++1y] ICE with deduced return type in virtual function and LTO)
PR c++/60574 * decl.c (grokdeclarator): Change permerror about 'virtual auto' to error. From-SVN: r208792
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c4
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/auto-fn25.C15
3 files changed, 23 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1acfec3..7dfb34f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2014-03-22 Jason Merrill <jason@redhat.com>
+
+ PR c++/60574
+ * decl.c (grokdeclarator): Change permerror about 'virtual auto'
+ to error.
+
2014-03-21 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/60384
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 4eb3e69..c912ffc 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -9553,8 +9553,8 @@ grokdeclarator (const cp_declarator *declarator,
"-std=gnu++1y");
}
else if (virtualp)
- permerror (input_location, "virtual function cannot "
- "have deduced return type");
+ error ("virtual function cannot "
+ "have deduced return type");
}
else if (!is_auto (type))
{
diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn25.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn25.C
new file mode 100644
index 0000000..628a685
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn25.C
@@ -0,0 +1,15 @@
+// PR c++/60574
+// { dg-options "-flto" }
+// { dg-do compile { target c++1y } }
+
+struct A
+{
+ virtual auto foo() {} // { dg-error "virtual.*deduced" }
+};
+
+struct B : A
+{
+ auto foo();
+};
+
+B b;