From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A23A43950424; Wed, 3 Mar 2021 15:36:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A23A43950424 From: "gcc at cookiesoft dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/99362] New: invalid unused result Date: Wed, 03 Mar 2021 15:36:23 +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: 10.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gcc at cookiesoft dot de 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 cf_gcctarget 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Mar 2021 15:36:23 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99362 Bug ID: 99362 Summary: invalid unused result Product: gcc Version: 10.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gcc at cookiesoft dot de Target Milestone: --- Target: arm The following code will emit a warning on arm 32 bit compilers: ``` struct S { [[nodiscard]] S() {} }; int main() { S s; } ``` ``` : In function 'int main()': :6:7: warning: ignoring return value of 'S::S()', declared with attribute 'nodiscard' [-Wunused-result] 6 | S s; | ^ :2:19: note: declared here 2 | [[nodiscard]] S() {} | ^ :6:7: warning: ignoring return value of 'S::S()', declared with attribute 'nodiscard' [-Wunused-result] 6 | S s; | ^ :2:19: note: declared here 2 | [[nodiscard]] S() {} | ^ Compiler returned: 0 ``` ``` S s =3D {} ``` does not emit such warning. Does not emit a warning on x86 compiler though. Does not emit a warning on 9.x branch, seems to be a regression. Godbolt link: https://godbolt.org/z/4Kof1x=