c++: vtable referring to "unavailable" virtual fn [PR116606]
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.
This commit is contained in:
parent
7d14839219
commit
d9d34f9a91
2 changed files with 10 additions and 1 deletions
|
@ -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;
|
||||
|
||||
|
|
8
gcc/testsuite/g++.dg/ext/attr-unavailable-13.C
Normal file
8
gcc/testsuite/g++.dg/ext/attr-unavailable-13.C
Normal file
|
@ -0,0 +1,8 @@
|
|||
// PR c++/116606
|
||||
// { dg-do compile }
|
||||
|
||||
struct C {
|
||||
__attribute__((unavailable)) virtual void f() {}
|
||||
};
|
||||
|
||||
C c;
|
Loading…
Add table
Reference in a new issue