https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120989
Bug ID: 120989
Summary: Shouldn't warn about the use of deprecated non-static
data members in implicit special member functions
Product: gcc
Version: 14.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: iamsupermouse at mail dot ru
Target Milestone: ---
Here's the testcase:
struct A
{
[[deprecated]] int x = 42;
};
int main()
{
A a;
A b = a;
a = b;
}
Here GCC warns about `A::x` being deprecated a few times, when it's used in the
implicitly generated special member functions.
I don't think it should warn here, only the manual uses of `x` should be
diagnosed. Clang has the same bug:
https://github.com/llvm/llvm-project/issues/147293 , while MSVC doesn't warn
about this.