MONDAY, OCTOBER 12, 2026
gcc/cp
C++/modules: Fix missed case in member specialization
Fixes an issue where clearing DECL_INITIAL for redefined specializations caused confusion in C++ modules.
This commit addresses a missed case in C++ modules related to member specialization. A previous change incorrectly cleared DECL_INITIAL for a redefined specialization, leading to downstream confusion. The fix ensures that redefinable imported definitions are not clobbered.
In Details
The change modifies check_explicit_specialization in pt.cc. It prevents DECL_INITIAL from being cleared for a redefinable imported definition, which was causing issues in the C++ module system's handling of explicit specializations. This resolves PR127787 and PR99000.
For Context
- DECL_INITIAL
- A GCC internal representation flag indicating if a declaration has an initializer.
- C++ modules
- A feature in C++ designed to improve build times and code organization by providing a more efficient alternative to traditional header files.
- explicit specialization
- A C++ construct that provides a specific implementation for a template when instantiated with certain types.