From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8DA633858410; Fri, 2 Dec 2022 09:34:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8DA633858410 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669973680; bh=dKiEZWXZ9WGYg9NKOJLrA1BdBgm435qY+d3Bis3C9ms=; h=From:To:Subject:Date:In-Reply-To:References:From; b=aJs5lB0STH/nwZvIMe3CsfIcvjaO8BMuyzbo0GO8cLf8y5/Im9Z186X2061lqiQz9 HjWX4alJqE2hLWPrZ5RfAmdVEVWaANau2s18Gu/enZOPnsPeyghIiIE5u8AVJ0qkeE 5CDA7Uaslq9VpfG529MdBXNDcalRtJXu96rK4stc= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/84469] structured binding inside for all loop thinks it is type depedent when it is not (inside a template) Date: Fri, 02 Dec 2022 09:34:39 +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: 8.0.1 X-Bugzilla-Keywords: rejects-valid 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: jakub 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=3D84469 --- Comment #9 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:f13305518558f20ef2d460a74eb29dad5fce1350 commit r13-4461-gf13305518558f20ef2d460a74eb29dad5fce1350 Author: Jakub Jelinek Date: Fri Dec 2 10:30:16 2022 +0100 c++: Incremental fix for g++.dg/gomp/for-21.C [PR84469] The PR84469 patch I've just posted regresses the for-21.C testcase, when in OpenMP loop there are at least 2 associated loops and in a template outer structured binding with non type dependent expressi= on is used in the expressions of some inner loop, we don't diagnose those any longer, as the (weirdly worded) diagnostics was only done during finish_id_expression -> mark_used which for the inner loop expressions happens before the structured bindings are finalized. When in template= s, mark_used doesn't diagnose uses of non-deduced variables, and if the range for expression is type dependent, it is similarly diagnosed during instantiation. But newly with the PR84469 fix if the range for express= ion is not type dependent, there is no place that would diagnose it, as dur= ing instantiation the structured bindings are already deduced. This patch ensures that the bug of using structured bindings from one associated loop in other associated loops is diagnosed by the c_omp_check_loop_iv code by ensuring that cp_finish_decomp is called already during cp_convert_omp_range_for if the artificial iterator has been successfully auto-deduced. 2022-12-02 Jakub Jelinek PR c++/84469 gcc/c-family/ * c-omp.cc (c_omp_is_loop_iterator): For range for with structu= red binding return TREE_VEC_LENGTH (d->declv) even if decl is equal to any of the structured binding decls. gcc/cp/ * parser.cc (cp_convert_omp_range_for): After do_auto_deduction= if !processing_template_decl call cp_finish_decomp with processing_template_decl temporarily incremented. gcc/testsuite/ * g++.dg/gomp/for-21.C (f3, f6, f9): Adjust expected diagnostic= s. * g++.dg/gomp/for-22.C: New test.=