C++ `std::initializer_list` with bases now rejected.
Fixes a compiler ICE by rejecting `std::initializer_list` when declared with base classes.
This commit addresses an issue where declaring std::initializer_list<T> with base classes could lead to an internal compiler error (ICE). Previously, the compiler only performed basic checks on this construct, such as verifying it was a class and not a union. The fix modifies the compiler to explicitly reject such declarations, preventing the ICE and ensuring correct type usage according to C++ standards.
In Details
The finish_struct function in class.cc is updated to reject std::initializer_list templates that have bases. This prevents an ICE that occurred during constant evaluation when such invalid constructs were encountered, as the compiler's existing checks were insufficient.
- std::initializer_list
- A lightweight proxy object type in C++ that permits a function to be called with an arbitrary number of arguments of the same type. It is commonly used for list-initialization.
- base class
- In C++ inheritance, a class from which another class derives. A derived class inherits members from its base class.
- ICE
- Internal Compiler Error. This signifies a bug within the compiler itself, where an unexpected condition or state is encountered, causing it to halt.
- constant evaluation
- The process by which the compiler evaluates expressions at compile time, typically for
constexprfunctions or variables.