Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- mark_vtable_entries already has
/* It's OK for the vtable to refer to deprecated virtual functions. */ warning_sentinel w(warn_deprecated_decl); but that doesn't cover __attribute__((unavailable)). We can use the following override to cover both. PR c++/116606 gcc/cp/ChangeLog: * decl2.cc (mark_vtable_entries): Temporarily override deprecated_state to UNAVAILABLE_DEPRECATED_SUPPRESS. Remove a warning_sentinel. gcc/testsuite/ChangeLog: * g++.dg/ext/attr-unavailable-13.C: New test. --- gcc/cp/decl2.cc | 3 ++- gcc/testsuite/g++.dg/ext/attr-unavailable-13.C | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/ext/attr-unavailable-13.C diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc index 3c4f34868ee..0279372488c 100644 --- a/gcc/cp/decl2.cc +++ b/gcc/cp/decl2.cc @@ -2180,7 +2180,8 @@ static void mark_vtable_entries (tree decl, vec<tree> &consteval_vtables) { /* It's OK for the vtable to refer to deprecated virtual functions. */ - warning_sentinel w(warn_deprecated_decl); + auto du = make_temp_override (deprecated_state, + UNAVAILABLE_DEPRECATED_SUPPRESS); bool consteval_seen = false; diff --git a/gcc/testsuite/g++.dg/ext/attr-unavailable-13.C b/gcc/testsuite/g++.dg/ext/attr-unavailable-13.C new file mode 100644 index 00000000000..9ca40005419 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attr-unavailable-13.C @@ -0,0 +1,8 @@ +// PR c++/116606 +// { dg-do compile } + +struct C { + __attribute__((unavailable)) virtual void f() {} +}; + +C c; base-commit: c880fca6cdb16c5efe3a12ee7ecdb2435f5e7105 -- 2.46.0