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

libstdc++: Make __valid_types_for_check_dynamic_spec static

Fixes C++26 formatting compilation errors on Clang/EDG by making a helper function static.

A static_assert within basic_format_parse_context::check_dynamic_spec failed to compile with Clang and EDG in C++26 mode due to an implicit this pointer use. This commit makes the helper function __valid_types_for_check_dynamic_spec static, as it does not use any non-static members. This change resolves the compilation issue for formatters calling check_dynamic_spec with various template arguments.

In Details

In std/format/parse_ctx.cc, basic_format_parse_context::check_dynamic_spec<_Ts...> uses static_assert(__valid_types_for_check_dynamic_spec<_Ts...>()). The helper __valid_types_for_check_dynamic_spec was a non-static consteval member. Compilers like Clang and EDG reject the static_assert operand when it implicitly dereferences this (as P2280R4 allows for consteval members), leading to errors like "implicit use of 'this' pointer is only allowed within the evaluation of a call to a 'constexpr' member function". Making the helper static removes the implicit this access and res…

For Context
static_assert
A compile-time assertion that checks a condition during compilation. If the condition is false, the compilation fails with a specified error message.
consteval
A C++20 specifier indicating that a function or variable must produce a constant value at compile time. It's a stricter form of constexpr.
constexpr
A C++ keyword that allows functions and variables to be evaluated at compile time, enabling more compile-time computations and optimizations.
libstdc++
The C++ standard library implementation used by GCC, providing common C++ functionalities like containers, algorithms, and I/O.
Filed Under: c++26compilation