https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122559
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <[email protected]>: https://gcc.gnu.org/g:caae42b31118f754fbd1f9566373f589d7e1568f commit r16-8106-gcaae42b31118f754fbd1f9566373f589d7e1568f Author: Jakub Jelinek <[email protected]> Date: Mon Mar 16 08:06:52 2026 +0100 c++: Fix up sb as condition instantiation error-recovery [PR120039] The following two testcases ICE during instantation. Normally for the artificial var used for structured binding as condition (which has NULL DECL_NAME) there is a DECL_EXPR which registers local specialization and so tsubst_expr works fine. But if there are errors while parsing the initializer, the VAR_DECL has still NULL_TREE DECL_NAME, but error_mark_node TREE_TYPE and when tsubst_expr is called on it, it falls back to calling lookup_name (NULL_TREE) and ICEs on that. The following patch fixes it by not calling lookup_name if DECL_NAME is NULL. 2026-03-16 Jakub Jelinek <[email protected]> PR c++/120039 PR c++/122559 * pt.cc (tsubst_expr) <case VAR_DECL>: Don't call lookup_name on DECL_NAME (t) if it is NULL_TREE. * g++.dg/cpp26/decomp28.C: New test. * g++.dg/cpp26/decomp29.C: New test. Reviewed-by: Jason Merrill <[email protected]>
