On Tue, Nov 29, 2022 at 04:38:50PM -0500, Jason Merrill wrote: > > --- gcc/testsuite/g++.dg/gomp/for-21.C.jj 2020-01-12 11:54:37.178401867 > > +0100 > > +++ gcc/testsuite/g++.dg/gomp/for-21.C 2022-11-29 13:06:59.038410557 > > +0100 > > @@ -54,9 +54,9 @@ 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 (auto [i, j, k] : a) // { dg-error "use of 'i' > > before deduction of 'auto'" } > > for (int l = i; l < j; l += k) // { dg-error "use of > > 'j' before deduction of 'auto'" } > > - ; // { dg-error "use of > > 'k' before deduction of 'auto'" "" { target *-*-* } .-3 } > > + ; // { dg-error "use of > > 'k' before deduction of 'auto'" "" { target *-*-* } .-1 } > > Hmm, this error is surprising: since the initializer is non-dependent, we > should have deduced immediately. I'd expect the same error as in the > non-structured-binding cases, "* expression refers to iteration variable".
The reason was just to be consistent what is (unfortunately) emitted in the other cases (!processing_template_decl or type dependent). I guess I could try how much work would it be to deduce it sooner, but generally it is pretty corner case, people rarely do this in OpenMP code. Jakub