https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79078
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Clang and EDG both procuce two warnings for this code, on the variable
definition and the call to operator+
struct [[deprecated("D is bad mmmkay")]] D {
void f(const D&);
};
void D::f(const D&) { }
[[deprecated("D is bad ")]] D operator+(const D&, const D&);
int main()
{
D d; // warning
d.f(d);
d + d; // warning
}
GCC produces seven warnings (and three notes)
d.cc:2:18: warning: ‘D’ is deprecated [-Wdeprecated-declarations]
void f(const D&);
^
d.cc:5:19: warning: ‘D’ is deprecated [-Wdeprecated-declarations]
void D::f(const D&) { }
^
d.cc:7:59: warning: ‘D’ is deprecated: D is bad mmmkay
[-Wdeprecated-declarations]
[[deprecated("D is bad ")]] D operator+(const D&, const D&);
^
d.cc:1:42: note: declared here
struct [[deprecated("D is bad mmmkay")]] D {
^
d.cc:7:59: warning: ‘D’ is deprecated [-Wdeprecated-declarations]
[[deprecated("D is bad ")]] D operator+(const D&, const D&);
^
d.cc:7:59: warning: ‘D’ is deprecated [-Wdeprecated-declarations]
d.cc: In function ‘int main()’:
d.cc:11:5: warning: ‘D’ is deprecated: D is bad mmmkay
[-Wdeprecated-declarations]
D d;
^
d.cc:1:42: note: declared here
struct [[deprecated("D is bad mmmkay")]] D {
^
d.cc:13:7: warning: ‘D operator+(const D&, const D&)’ is deprecated: D is bad
[-Wdeprecated-declarations]
d + d;
^
d.cc:7:31: note: declared here
[[deprecated("D is bad ")]] D operator+(const D&, const D&);
^~~~~~~~