[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / CodeGenCXX / flexible-array-init.cpp
blob26854b1723c4ccbf783304b1371bf4005b187202
1 // RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-only -verify -DFAIL1 %s
3 // RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-only -verify -DFAIL2 %s
4 // RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-only -verify -DFAIL3 %s
6 struct A { int x; int y[]; };
7 A a = { 1, 7, 11 };
8 // CHECK: @a ={{.*}} global { i32, [2 x i32] } { i32 1, [2 x i32] [i32 7, i32 11] }
10 A b = { 1, { 13, 15 } };
11 // CHECK: @b ={{.*}} global { i32, [2 x i32] } { i32 1, [2 x i32] [i32 13, i32 15] }
13 char f();
14 #ifdef FAIL1
15 A c = { f(), { f(), f() } }; // expected-error {{cannot compile this flexible array initializer yet}}
16 #endif
17 #ifdef FAIL2
18 void g() {
19 static A d = { f(), { f(), f() } }; // expected-error {{cannot compile this flexible array initializer yet}}
21 #endif
22 #ifdef FAIL3
23 struct B { int x; char y; char z[]; };
24 B e = {f(), f(), f(), f()}; // expected-error {{cannot compile this flexible array initializer yet}}
25 #endif
27 namespace zero_initializer {
28 A a0{0, 0}, a1{0, {0, 0}};
29 // CHECK: @_ZN16zero_initializer2a0E = global { i32, [1 x i32] } zeroinitializer,
30 // CHECK: @_ZN16zero_initializer2a1E = global { i32, [2 x i32] } zeroinitializer,
32 struct S { int x[]; };
34 S s{0};
35 // CHECK: @_ZN16zero_initializer1sE = global { [1 x i32] } zeroinitializer,