GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
gcc/c++/reflection

C++/reflection: members_of skips built-in functions.

Reflection API now correctly excludes built-in functions from member listings.

The C++ reflection API’s members_of function no longer includes compiler built-ins, such as __builtin_fdimf32x. This change uses DECL_IS_UNDECLARED_BUILTIN to filter these out, significantly reducing the number of elements returned and producing more accurate results for reflection queries.

In Details

C++20 reflection P0157R1 implementation, specifically members_of. This commit adds a check for DECL_IS_UNDECLARED_BUILTIN to namespace_members_of to prevent intrinsic functions like __builtin_abs from being exposed in reflection results, while still allowing user-defined functions like abs.

For Context
C++ reflection
A C++ language feature that allows a program to inspect and manipulate its own structure, metadata, and behavior at runtime. Typically involves querying information about types, members, and functions.
members_of
A function within the C++ reflection library that returns a list of members (fields, methods, etc.) belonging to a specified type or namespace.
__builtin_fdimf32x
An example of a compiler built-in function, providing optimized, low-level functionality often not directly implemented by user code.
DECL_IS_UNDECLARED_BUILTIN
An internal GCC compiler flag or attribute used to identify declarations that correspond to compiler-provided built-in functions, distinguishing them from standard library or user-defined functions.
Filed Under: c++reflectioncompiler