GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
c++

C++: Ignore consteval-only uses inside USING_STMT.

Prevents USING_STMT operands from being considered as consteval-only uses in the C++ compiler.

This commit modifies the C++ compiler to prevent operands within a USING_STMT from being counted as consteval-only uses. The change ensures that the compiler doesn’t incorrectly restrict the use of variables or expressions within a USING_STMT to only consteval contexts (PR125184).

In Details

The commit modifies check_out_of_consteval_use_r in reflect.cc to avoid walking the children of USING_STMT nodes. This prevents the compiler from incorrectly flagging uses within a USING_STMT as consteval-only, which could lead to unexpected compile-time errors.

For Context

In C++, using statements introduce names from a namespace or a specific class into the current scope allowing their use without explicit qualification. This commit addresses a scenario where the compiler was incorrectly interpreting uses of variables or expressions within a using statement as being restricted to compile-time evaluation only. By ignoring these uses, the compiler now allows more flexible usage of these elements.

Filed Under: c++constevalusing statementreflection