From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6A1833858D3C; Wed, 1 Feb 2023 21:55:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A1833858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675288504; bh=odTz3/n3mcf/QaLVSzHTHEa2PJ+OYrvfp+nSMMCuhz8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZZiH/LuPPJ6MXF/3AwrmRpqv9bfX2+zC9+V1xlC/CU/BJREl7oCfUyl3iH89ixiRj 2SAmvcXTHsIc/r8xzU/5TvBhK4t15vMrBq3oQUUl5+KjdFfmdhwVg5+BjJp/3hEd7w yQmXb07O4G6xxetRRMdI2v54nCWnHkvE2V7bIjbo= From: "mpolacek at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108165] -Wdangling-reference false positive Date: Wed, 01 Feb 2023 21:55:04 +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.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: mpolacek at gcc dot gnu.org X-Bugzilla-Status: NEW 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: 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=3D108165 --- Comment #9 from Marek Polacek --- But even that won't work for Wdangling-reference6.C where the argtype is int but the rettype is std::pair. Really, all I could do is to warn only when all the arguments to the functi= on returning a reference are temporaries, e.g. don't warn on f(a, a); f(a, 42); f(42, a); only on f(42, 42);=