commit 62fa8dfdd93b964246d06f3d5b41a3c2659509f3
Author: Jason Merrill <jason@redhat.com>
Date: Thu Mar 20 17:14:19 2014 -0400
PR c++/60574
* decl.c (grokdeclarator): Change permerror about 'virtual auto'
to error.
@@ -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))
{
new file mode 100644
@@ -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;