]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/60574 ([c++1y] ICE with deduced return type in virtual function and LTO)
authorJason Merrill <jason@redhat.com>
Mon, 24 Mar 2014 15:55:43 +0000 (11:55 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 24 Mar 2014 15:55:43 +0000 (11:55 -0400)
PR c++/60574
* decl.c (grokdeclarator): Change permerror about 'virtual auto'
to error.

From-SVN: r208792

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/g++.dg/cpp1y/auto-fn25.C [new file with mode: 0644]

index 1acfec335f642f88ca4ef3ce8ce0b85ee3d37be8..7dfb34f6bbb70f96456ad35d242f7eaa66bcdb4d 100644 (file)
@@ -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
index 4eb3e69af7953086f45017100ead5eeef711b974..c912ffcb50622ce524fd6ffa08ea827d7542c62b 100644 (file)
@@ -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 (file)
index 0000000..628a685
--- /dev/null
@@ -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;