From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7FFAE385B196; Mon, 28 Nov 2022 08:54:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7FFAE385B196 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669625674; bh=75Z+RqBOdC9HoVlRfYuGWXeDCbmVkuW3RI9SIjEhP18=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qwdzcGQXUx9/VEb/4JIirQWaf6UUbfzD0e4nK5jCGd3rBSErJV1q9wHenSaGbaSkV Yhv+CeT/eJyO0Rp51NxrEx33VWPld4jrDUCDWPZSvDUGXUWQYGmBSe0SW3WJMRqUmQ NhCXw0Y6+eS7fg9vM5y0MK0bYgyTma9HZYF+gSaY= From: "jakub 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: Mon, 28 Nov 2022 08:54:34 +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: jakub 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 #7 from Jakub Jelinek --- The patch unfortunately regresses the OpenMP g++.dg/gomp/for-21.C test: template void f6 (S (&a)[10]) { #pragma omp for collapse (2) for (auto [i, j, k] : a) // { dg-error "use of 'i' before deduction of 'auto'" "" { target *-*-* } .-1 } for (int l =3D i; l < j; l +=3D k) // { dg-error "use of '= j' before deduction of 'auto'" } ; // { dg-error "use of 'k' before deduction of 'auto'" "" { target *-*-* } .-3 } } ... S c[10] {}; f6 <0> (c); where the bug is no longer diagnosed. When not in a template or when the range for decl is type dependent, it works because the invalid uses are diagnosed by finish_id_expression -> mark_used and complain about uses of a= uto before it is deduced, but in the above case a is not type dependent, mark_u= sed doesn't complain about uses of auto when processing_template_decl and the n= ew code deduces a and i/j/k before finish_id_expression is called on it again during instantiation. So, I'll need to add further code to handle this right.=