https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116606
Bug ID: 116606
Summary: unavailable attribute on virtual function causes error
on object construction
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: rs2740 at gmail dot com
Target Milestone: ---
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html says that
"Other than emitting an error rather than a warning, the unavailable attribute
behaves in the same manner as deprecated."
But GCC trunk rejects
struct C {
__attribute__((unavailable)) virtual void f() {}
};
C c;
<source>:2:47: error: 'virtual void C::f()' is unavailable
2 | __attribute__((unavailable)) virtual void f() {}
| ^
<source>:2:47: note: declared here
even though the version with deprecated doesn't emit a warning.