GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
c++

C++: Fix structured binding pack instantiation ICE.

Resolves an internal compiler error when instantiating structured bindings with argument packs.

This change fixes an internal compiler error (ICE) occurring during the instantiation of structured bindings that involve argument packs. The error happened because a function expected a declaration of a decomposition type but received an argument pack select instead. The fix modifies the code to correctly handle both possibilities, preventing the assertion failure.

In Details

The tsubst_pack_expansion function in pt.cc previously asserted that retrieve_local_specialization must return a DECL_DECOMPOSITION_P for a parameter pack. This commit updates the function to also accept and handle ARGUMENT_PACK_SELECT when retrieve_local_specialization returns it, resolving an ICE in PR125591.

For Context
structured binding
A C++ language feature (since C++17) that allows decomposing an object into individual names, often used with tuples or structs.
argument pack
In C++ variadic templates, an argument pack is a pack of zero or more template arguments.
ICE
Internal Compiler Error. A crash within the compiler itself, usually indicating a bug in the compiler's logic.
DECL_DECOMPOSITION_P
A GCC internal tree node flag indicating that a declaration represents a decomposition (e.g., for structured bindings).
ARGUMENT_PACK_SELECT
A GCC internal tree node code representing a selection from an argument pack.
Filed Under: c++compiler bug