| 1 |
// Test that we can successfully compile this code, especially under ASAN. |
| 2 |
// RUN: %clang_cc1 -emit-llvm -std=c++20 %s -o- | FileCheck %s |
| 3 |
struct RR { int r; }; |
| 4 |
struct Z { int x; const RR* y; int z; }; |
| 5 |
constinit Z z = { 10, (const RR[1]){__builtin_constant_p(z.x)}, z.y->r }; |
| 6 |
// Check that we zero-initialize z.y->r. |
| 7 |
// CHECK: @.compoundliteral = internal constant [1 x %struct.RR] zeroinitializer |
| 8 |
// FIXME: Despite of z.y->r being 0, we evaluate z.z to 1. |
| 9 |
// CHECK: global %struct.Z { i32 10, ptr @.compoundliteral, i32 1 } |