https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92145
Bug ID: 92145 Summary: -Wdeprecated-copy false-positive when inheriting base assignment operators Product: gcc Version: 10.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: nok.raven at gmail dot com Target Milestone: --- // https://godbolt.org/z/UAc5tq struct base { base() { } base(const base&) { } base(base&&) { } base& operator=(const base&) { return *this; } base& operator=(base&&) { return *this; } }; struct foo : base { //using base::base; using base::operator=; }; struct bar { bar& operator=(foo v) { value = v; return *this; } foo value; }; int main() { foo a; foo{a}; } source>: In member function 'bar& bar::operator=(foo)': <source>:20:17: warning: implicitly-declared 'foo& foo::operator=(const foo&)' is deprecated [-Wdeprecated-copy] 20 | value = v; | ^ <source>:6:11: note: because 'foo' has user-provided 'base& base::operator=(const base&)' 6 | base& operator=(const base&) { return *this; } | ^~~~~~~~ <source>: In function 'int main()': <source>:30:10: warning: implicitly-declared 'foo::foo(const foo&)' is deprecated [-Wdeprecated-copy] 30 | foo{a}; | ^ <source>:6:11: note: because 'foo' has user-provided 'base& base::operator=(const base&)' 6 | base& operator=(const base&) { return *this; } | ^~~~~~~~