From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 565673942438; Wed, 12 Jan 2022 20:02:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 565673942438 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/103991] [12 Regression] Bogus -Wreturn-type with constexpr if and local var with destructor Date: Wed, 12 Jan 2022 20:02:56 +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: 12.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 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 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, 12 Jan 2022 20:02:56 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103991 --- Comment #8 from Jakub Jelinek --- (In reply to rguenther@suse.de from comment #7) > > Now, as Richi's warning isn't in GCC 12, quickest/safest temporary fix = would be > > to revert to previous behavior for IF_STMT_CONSTEXPR_P and IF_STMT_CONS= TEVAL_P, > > if (IF_STMT_CONSTEVAL_P (stmt)) > > stmt =3D else_; > > else if (IF_STMT_CONSTEXPR_P (stmt)) > > stmt =3D integer_nonzerop (cond) ? then_ ? else_; > > else > > stmt =3D build3 (COND_EXPR, void_type_node, cond, then_, else_); >=20 > I agree that reverting for GCC 12 is the most reasonable thing with addin= g a > Testcase The above isn't a full reversion, it keeps the normal if (which isn't problematic) as is and just reverts behavior for the special const{expr,eva= l} ifs.=