From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 66DDD38582A3; Sun, 18 Dec 2022 17:41:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 66DDD38582A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671385296; bh=eRUq4PVbRP2pauDgz8g7VRwPHPyRZ9+QosZgN7cRZ8E=; h=From:To:Subject:Date:From; b=HBEqx6JRdpl4icCfxm9K1cHKBZXXp2Be4vdWYrqT797yT6/UJUTDltXovQWvhP198 gxVL+RHbskrx1d6eVnL1tZM+UUdmPPC3Vue+woNU492xwcDHk/9F3VuZb3VN2SW08S lv1TqwA3KHKSBCHkKBUuh4F9ctJhNgjWm6U/9eSI= From: "romain.geissler at amadeus dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108165] New: -Wdangling-reference false positive Date: Sun, 18 Dec 2022 17:41:36 +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: romain.geissler at amadeus 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=3D108165 Bug ID: 108165 Summary: -Wdangling-reference false positive Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: romain.geissler at amadeus dot com Target Milestone: --- Hi, The following snippet issues a wrong -Wdangling-reference warning when comp= iled with -Wall with current gcc trunk: <: In function 'const A& g(const A&)': :13:14: warning: possibly dangling reference to a temporary [-Wdangling-reference] 13 | const A& result =3D f(a, 42); | ^~~~~~ :13:24: note: the temporary was destroyed at the end of the full expression 'f((* & a), B(42))' 13 | const A& result =3D f(a, 42); | ~^~~~~~~ ASM generation compiler returned: 0 : In function 'const A& g(const A&)': :13:14: warning: possibly dangling reference to a temporary [-Wdangling-reference] 13 | const A& result =3D f(a, 42); | ^~~~~~ :13:24: note: the temporary was destroyed at the end of the full expression 'f((* & a), B(42))' 13 | const A& result =3D f(a, 42); | ~^~~~~~~=