From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C12183857B9A; Mon, 24 Oct 2022 18:07:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C12183857B9A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666634826; bh=0t6xw430ka6rpul1xbdjwoQBDk+HUR9Qkx95ovtnBx8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Bhtgi1bEAB0KalHxG+gbg7AVlw9pYHhIuNrJiBLF+cT68wnbieLixo7gla3A3Cde7 nK6mHxzm3y2mNvTXUPFM6Xn4sPu6eNdkqWCOkYIOJsc69jtqSmwIkXgQKZWhe9BWwm y/hzW9EeNU7m4FQdmXWVFMD++HeTLmVBppJ8ktzI= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107276] ICE Deducing return type from ill-formed structured binding name since r13-2905-g772d532e0ba1e4b2 Date: Mon, 24 Oct 2022 18:07:05 +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: error-recovery, ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: mpolacek 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=3D107276 --- Comment #5 from CVS Commits --- The trunk branch has been updated by Marek Polacek : https://gcc.gnu.org/g:f7d8ccfda2d5c90dac97b1a3ede8b10391a3cc40 commit r13-3462-gf7d8ccfda2d5c90dac97b1a3ede8b10391a3cc40 Author: Marek Polacek Date: Thu Oct 20 15:55:28 2022 -0400 c++: ICE with invalid structured bindings [PR107276] This test ICEs in C++23 because we reach the new code in do_auto_deduct= ion: 30468 if (cxx_dialect >=3D cxx23 30469 && context =3D=3D adc_return_type 30470 && (!AUTO_IS_DECLTYPE (auto_node) 30471 || !unparenthesized_id_or_class_member_access_p (init)) 30472 && (r =3D treat_lvalue_as_rvalue_p (maybe_undo_parenthesize= d_ref (init), 30473 /*return*/true))) where 'init' is "VIEW_CONVERT_EXPR<<<< error >>>>(y)", and then the move in treat_lvalue_as_rvalue_p returns error_mark_node whereupon set_implicit_rvalue_p crashes. I don't think such V_C_Es are useful so let's not create them. But that won't fix the ICE so I'm checking the return value of move. A structur= ed bindings decl can have an error type, that is set in cp_finish_decomp: 8908 TREE_TYPE (first) =3D error_mark_node; therefore I think treat_lvalue_as_rvalue_p just needs to cope. PR c++/107276 gcc/cp/ChangeLog: * typeck.cc (treat_lvalue_as_rvalue_p): Check the return value = of move. gcc/ChangeLog: * tree.cc (maybe_wrap_with_location): Don't create a location wrapper when the type is erroneous. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/decomp4.C: New test.=