On Mon, Aug 25, 2025 at 03:49:56PM -0400, Jason Merrill wrote: > On 8/25/25 10:53 AM, Jakub Jelinek wrote: > > On Mon, Aug 25, 2025 at 09:44:29AM -0400, Jason Merrill wrote: > > > > --- gcc/cp/pt.cc.jj 2025-08-23 15:00:04.262787988 +0200 > > > > +++ gcc/cp/pt.cc 2025-08-23 15:51:08.726081054 +0200 > > > > @@ -22321,6 +22321,13 @@ tsubst_expr (tree t, tree args, tsubst_f > > > > if (DECL_NAME (t) == this_identifier && current_class_ptr) > > > > RETURN (current_class_ptr); > > > > + /* Parameters during expansion stmt body instantiation > > > > outside > > > > + of templates map to themselves. */ > > > > + if (current_tinst_level > > > > + && (TREE_CODE (current_tinst_level->tldcl) > > > > + == TEMPLATE_FOR_STMT)) > > > > + RETURN (t); > > > > > > Rather than checking specifically for an expansion stmt, I'd prefer to > > > check > > > for the general case of the parameter not being in a template, perhaps > > > with > > > > > > if (!uses_template_parms (DECL_CONTEXT (t)) > > > > > > since that test is already used in the controlling if? > > > > That works too on > > GXX_TESTSUITE_STDS=98,11,14,17,20,23,26 make check-g++ > > RUNTESTFLAGS="dg.exp='expansion-stmt*'" > > too, ok for trunk if it passes full bootstrap/regtest? > > OK.
Unfortunately that version (unlike the previous one) regresses: FAIL: g++.dg/modules/xtreme-header-2_c.C -std=c++26 (internal compiler error: tree check: expected record_type or union_type or qual_union_type, have template_type_parm in lookup_base, at cp/search.cc:264) FAIL: g++.dg/modules/xtreme-header-2_c.C -std=c++26 (test for excess errors) FAIL: g++.dg/modules/xtreme-header-4_c.C -std=c++26 (internal compiler error: tree check: expected record_type or union_type or qual_union_type, have template_type_parm in lookup_base, at cp/search.cc:264) FAIL: g++.dg/modules/xtreme-header-4_c.C -std=c++26 (test for excess errors) FAIL: g++.dg/modules/xtreme-header-5_c.C -std=c++26 (internal compiler error: tree check: expected record_type or union_type or qual_union_type, have template_type_parm in lookup_base, at cp/search.cc:264) FAIL: g++.dg/modules/xtreme-header-5_c.C -std=c++26 (test for excess errors) FAIL: g++.dg/modules/xtreme-header-6_c.C -std=c++26 (internal compiler error: tree check: expected record_type or union_type or qual_union_type, have template_type_parm in lookup_base, at cp/search.cc:264) FAIL: g++.dg/modules/xtreme-header-6_c.C -std=c++26 (test for excess errors) FAIL: std/ranges/access/crend.cc -std=gnu++20 (test for excess errors) UNRESOLVED: std/ranges/access/crend.cc -std=gnu++20 compilation failed to produce executable FAIL: std/ranges/access/crend.cc -std=gnu++26 (test for excess errors) UNRESOLVED: std/ranges/access/crend.cc -std=gnu++26 compilation failed to produce executable FAIL: std/ranges/access/rend.cc -std=gnu++20 (test for excess errors) UNRESOLVED: std/ranges/access/rend.cc -std=gnu++20 compilation failed to produce executable FAIL: std/ranges/access/rend.cc -std=gnu++26 (test for excess errors) UNRESOLVED: std/ranges/access/rend.cc -std=gnu++26 compilation failed to produce executable Will try to investigate what's going on tomorrow^H^H^Htoday. Jakub