10 lines · cpp
1// Test that we can successfully compile this code, especially under ASAN.2// RUN: %clang_cc1 -emit-llvm -std=c++20 %s -o- | FileCheck %s3struct RR { int r; };4struct Z { int x; const RR* y; int z; };5constinit 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] zeroinitializer8// 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 }10