Fix mangling of aggregates containing std::meta::info
Corrected C++ name mangling for aggregates with std::meta::info members.
A C++ compiler ICE (Internal Compiler Error) occurred during name mangling for aggregate initializers containing std::meta::info types. This commit fixes two issues: it prevents build_zero_cst from being used incorrectly for skipped members of std::meta::info type, instead using get_null_reflection(), and ensures that aggregates with identical zero-initialized members are mangled identically, regardless of whether members are explicitly listed or skipped.
In Details
This commit addresses PR126922 in the C++ frontend, specifically within the name mangling logic (mangle.cc) and type system (tree.cc). The issue arose from using build_zero_cst for skipped members of std::meta::info type during aggregate initialization, which is inappropriate as build_zero_cst is unaware of reflection types. The fix replaces build_zero_cst with get_null_reflection() for these cases. Additionally, it modifies zero_init_expr_p to treat null reflections of std::meta::info type consistently with other zero-initialized expressions, ensuring identical mangling for…
- name mangling
- The process of encoding type information into function and class names in C++ to support features like function overloading and namespaces. This allows the linker to distinguish between entities with the same base name but different signatures.
- aggregate initialization
- Initializing an object of an aggregate type (like a struct or class with public members and no user-declared constructors) using a brace-enclosed list of values.
- std::meta::info
- A C++ type likely used for reflection or metaprogramming, allowing code to inspect and manipulate type information at runtime or compile time.
- ICE
- Internal Compiler Error. An unrecoverable error during compilation that halts the process, usually indicating a bug in the compiler itself.