Starting with r256795 gcc ICEs on: struct S { int a, b; }; template <bool> void foo () { S x[2]; auto f = [](auto & y) { for (auto & [ u, v ] : y) ; }; f (x); } int main () { foo<true> (); } with -std=c++17, previously it has been incorrectly rejected.
Created attachment 44614 [details] gcc9-pr87122.patch Untested fix.
Author: jakub Date: Wed Aug 29 12:27:55 2018 New Revision: 263953 URL: https://gcc.gnu.org/viewcvs?rev=263953&root=gcc&view=rev Log: PR c++/87122 * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: If processing_template_decl and decl is structured binding decl, call cp_finish_decomp. * g++.dg/cpp1z/decomp47.C: New test. Added: trunk/gcc/testsuite/g++.dg/cpp1z/decomp47.C Modified: trunk/gcc/ChangeLog trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c trunk/gcc/testsuite/ChangeLog
Author: jakub Date: Wed Aug 29 12:32:13 2018 New Revision: 263954 URL: https://gcc.gnu.org/viewcvs?rev=263954&root=gcc&view=rev Log: PR c++/87122 * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: If processing_template_decl and decl is structured binding decl, call cp_finish_decomp. * g++.dg/cpp1z/decomp47.C: New test. Added: branches/gcc-8-branch/gcc/testsuite/g++.dg/cpp1z/decomp47.C Modified: branches/gcc-8-branch/gcc/cp/ChangeLog branches/gcc-8-branch/gcc/cp/pt.c branches/gcc-8-branch/gcc/testsuite/ChangeLog
Fixed.