https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125123
--- Comment #13 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:833722e02b083a5828e0f7dbf67ae5456755f0de commit r17-1041-g833722e02b083a5828e0f7dbf67ae5456755f0de Author: Jakub Jelinek <[email protected]> Date: Sat May 30 17:49:18 2026 +0200 c++: Don't ICE on the static constexpr expansion-stmt vars during mangling [PR125123] The following testcase ICEs, because we decide to mangle the (for the time being as workaround static constexpr variables created for expansion statements). And if there is more than one in the same function and we mangle both, we ICE because they mangle the same. The problem is that cp_finish_decl does not determine_local_discriminator for DECL_ARTIFICIAL vars. The following patch fixes that by calling it even for DECL_ARTIFICIAL vars. The patch also sets DECL_IGNORED_P on those vars, I think there is no value exposing those in the debug information, the iterating is done at compile time and all user IMHO cares are the individual user variables initialized to whatever was derived from the temporaries. 2026-05-29 Jakub Jelinek <[email protected]> PR c++/125123 * parser.cc (cp_build_range_for_decls): If range_temp or begin are static, set DECL_IGNORED_P on it. * pt.cc (finish_expansion_stmt): Similarly for iter. * decl.cc (cp_finish_decl): Call determine_local_discriminator etc. also for DECL_ARTIFICIAL TREE_STATIC vars. * g++.dg/cpp26/expansion-stmt42.C: New test. Reviewed-by: Jason Merrill <[email protected]>
