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