From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ED36A38582AE; Tue, 6 Sep 2022 10:33:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ED36A38582AE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662460413; bh=7ewyc2thp+khzjlnXqn5EYvyHNobKjY9+ov6TH3DtqQ=; h=From:To:Subject:Date:From; b=nfds2M7NIUloTfzhSYbGIXK/GZM+RJQAJwWpDQwQItZg8GlwHV1FqnDWjHFFFWvKg AJNXfygDZfvAogsnCdfuXRsLcb37fC8jS7M8z1UL8hAqPquK4UB4ct5j96gXv43YGS g4Lj2deyF01XEG30H/+ghnoJ+RWLkEU5CZh6idZk= From: "avi at scylladb dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/106847] New: deprecated class data member makes the class generate diagnostics even when the member is not used Date: Tue, 06 Sep 2022 10:33:33 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: avi at scylladb dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106847 Bug ID: 106847 Summary: deprecated class data member makes the class generate diagnostics even when the member is not used Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: avi at scylladb dot com Target Milestone: --- A class with a deprecated member: struct foo { [[deprecated]] bool x; }; Cannot be used without lots of noise from the compiler: foo make_a_foo() { foo f; return f; } : In function 'foo make_a_foo()': :10:12: warning: 'f' is used uninitialized [-Wuninitialized] 10 | return f; | ^ :9:9: note: 'f' declared here 9 | foo f; | ^ Compiler returned: 0 Although I didn't touch x, the compiler thinks I did. IMO synthesized constructors (and assignment operators) should suppress the warning and only explicit access by the user should trigger the warning.=