]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/64901 (overriding final function defined out of line does not lead to an...
authorVille Voutilainen <ville.voutilainen@gmail.com>
Wed, 4 Feb 2015 15:38:50 +0000 (17:38 +0200)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 4 Feb 2015 15:38:50 +0000 (15:38 +0000)
2015-02-04  Ville Voutilainen  <ville.voutilainen@gmail.com>

PR c++/64901
* decl.c (duplicate_decls): Also duplicate DECL_FINAL_P and
DECL_OVERRIDE_P.

From-SVN: r220409

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/g++.dg/cpp0x/override1.C

index 01d3471e43b6bea13894bb5e43d73da420462895..83bf91d54bc949f1ec8f5ef2924d07a34f303462 100644 (file)
@@ -1,3 +1,9 @@
+2015-02-04  Ville Voutilainen  <ville.voutilainen@gmail.com>
+
+       PR c++/64901
+       * decl.c (duplicate_decls): Also duplicate DECL_FINAL_P and
+       DECL_OVERRIDE_P.
+
 2015-01-29  Jason Merrill  <jason@redhat.com>
 
        PR c++/64521
index 1613e9ac0aa8ab3cdfa3c63f2d4b5419dc7704a4..4cc386e117f9f415e7983f424708d0bd3ae6eee0 100644 (file)
@@ -1788,6 +1788,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
       DECL_PURE_VIRTUAL_P (newdecl) |= DECL_PURE_VIRTUAL_P (olddecl);
       DECL_VIRTUAL_P (newdecl) |= DECL_VIRTUAL_P (olddecl);
       DECL_INVALID_OVERRIDER_P (newdecl) |= DECL_INVALID_OVERRIDER_P (olddecl);
+      DECL_FINAL_P (newdecl) |= DECL_FINAL_P (olddecl);
+      DECL_OVERRIDE_P (newdecl) |= DECL_OVERRIDE_P (olddecl);
       DECL_THIS_STATIC (newdecl) |= DECL_THIS_STATIC (olddecl);
       if (DECL_OVERLOADED_OPERATOR_P (olddecl) != ERROR_MARK)
        SET_OVERLOADED_OPERATOR_CODE
index e05693fc59088776c3dd6ba8dc353de3a78922b2..77f6034b8354ad9171312fcd13ff0995285453c4 100644 (file)
@@ -4,8 +4,11 @@ struct B
   virtual void f() final {}
   virtual void g() {}
   virtual void x() const {}
+  virtual void y() final;
 };
 
+void B::y() {} // { dg-error "overriding" }
+
 struct B2
 {
   virtual void h() {}
@@ -14,6 +17,7 @@ struct B2
 struct D : B
 {
   virtual void g() override final {} // { dg-error "overriding" }
+  virtual void y() override final {} // { dg-error "virtual" }
 };
 
 template <class T> struct D2 : T