This checks if the layout of `std::initializer_list` is something Clang can handle much earlier and deduplicates the checks in CodeGen/CGExprAgg.cpp and AST/ExprConstant.cpp Also now diagnose `union initializer_list` (Fixes #95495), bit-field for the size (Fixes a crash that would happen during codegen if it were unnamed), base classes (that wouldn't be initialized) and polymorphic classes (whose vtable pointer wouldn't be initialized).
10 lines
194 B
C++
10 lines
194 B
C++
namespace std {
|
|
using size_t = decltype(sizeof(0));
|
|
|
|
template<typename T> struct initializer_list {
|
|
const T* ptr; size_t sz;
|
|
};
|
|
|
|
template<typename T> int min(initializer_list<T>);
|
|
}
|