mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 05:56:36 +00:00

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).
25 lines
622 B
C++
25 lines
622 B
C++
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 -fcoverage-mapping %s
|
|
// expected-no-diagnostics
|
|
|
|
// GH62105 demonstrated a crash with this example code when calculating
|
|
// coverage mapping because some source location information was being dropped.
|
|
// Demonstrate that we do not crash on this code.
|
|
namespace std { template <typename E> class initializer_list { const E *a, *b; }; }
|
|
|
|
template <typename> struct T {
|
|
T(std::initializer_list<int>, int = int());
|
|
bool b;
|
|
};
|
|
|
|
template <typename> struct S1 {
|
|
static void foo() {
|
|
class C;
|
|
(void)(0 ? T<C>{} : T<C>{});
|
|
}
|
|
};
|
|
|
|
void bar() {
|
|
S1<int>::foo();
|
|
}
|
|
|