re PR c++/65974 (Bogus deprecated-declarations warnings for inline definitions of...
authorJason Merrill <jason@redhat.com>
Sat, 15 Aug 2015 07:59:26 +0000 (03:59 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 15 Aug 2015 07:59:26 +0000 (03:59 -0400)
PR c++/65974
* decl2.c (mark_vtable_entries): Suppress -Wdeprecated.

From-SVN: r226908

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/g++.dg/warn/deprecated-9.C [new file with mode: 0644]

index e8008ce0140a5369d4884e2edb1f03cbedf34072..a5a42ff11a570fb7bbfc28696fa8cc9665fd7c13 100644 (file)
@@ -1,3 +1,8 @@
+2015-08-14  Jason Merrill  <jason@redhat.com>
+
+       PR c++/65974
+       * decl2.c (mark_vtable_entries): Suppress -Wdeprecated.
+
 2015-08-12  Jason Merrill  <jason@redhat.com>
 
        PR c++/67104
index 8e7a453ec1bbba7adc59b8ddf04750aa27c1bd13..74ba380c44df0db2d44939deea6b1a7c146a4f98 100644 (file)
@@ -1747,6 +1747,9 @@ mark_vtable_entries (tree decl)
   tree fnaddr;
   unsigned HOST_WIDE_INT idx;
 
+  /* It's OK for the vtable to refer to deprecated virtual functions.  */
+  warning_sentinel w(warn_deprecated_decl);
+
   FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (DECL_INITIAL (decl)),
                              idx, fnaddr)
     {
diff --git a/gcc/testsuite/g++.dg/warn/deprecated-9.C b/gcc/testsuite/g++.dg/warn/deprecated-9.C
new file mode 100644 (file)
index 0000000..fc861ee
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/65974
+// { dg-options "-Wdeprecated" }
+
+struct S {
+    void bar();
+
+    __attribute__((deprecated("use bar() instead.")))
+    virtual void foo();
+};
+
+void S::foo() { bar(); }
+
+int main()
+{
+    return 0;
+}