From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ECF2B3858C3A; Fri, 19 Jan 2024 23:32:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ECF2B3858C3A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705707145; bh=SltaWcF0WYhtPh8DvZwoEV2uVkiGRCbBHJW93V+uweY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fg3y6UVN62skSRRLLTyYg7LcPqiPmYte2efg53G7ndFVafPWlGSuEhUCEvj5pCFsE 1zet7ZlNTqR/22u+uYfIlGmkio4vSg7Pw9wknkQn862op4TSxYnShGK8TRk0gIZzdl gx3JuQWVrp3ykB8uxBPv9x6peYT3JQLbvXsGcH/A= From: "mpolacek at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/111159] [13/14 Regression] False positive -Wdangling-reference Date: Fri, 19 Jan 2024 23:32:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.2.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: mpolacek at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: DUPLICATE X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: resolution bug_status Message-ID: In-Reply-To: References: 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=3D111159 Marek Polacek changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |DUPLICATE Status|UNCONFIRMED |RESOLVED --- Comment #2 from Marek Polacek --- I think so too; I'm afraid there's no heuristic I could implement. You can disable the warning for this class using: #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdangling-reference" struct A { int * i; int & b() { return *i; } }; #pragma GCC diagnostic pop *** This bug has been marked as a duplicate of bug 109642 ***=