[AMDGPU][True16][CodeGen] true16 codegen pattern for v_med3_u/i16 (#121850)
[llvm-project.git] / clang / test / CodeGenCXX / flexible-array-init.cpp
bloba711e7102989e29cf0dddf37d81aaeb68e000cc9
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
5 // RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-only -verify -DFAIL4 %s
7 struct A { int x; int y[]; };
8 A a = { 1, 7, 11 };
9 // CHECK: @a ={{.*}} global { i32, [2 x i32] } { i32 1, [2 x i32] [i32 7, i32 11] }
11 A b = { 1, { 13, 15 } };
12 // CHECK: @b ={{.*}} global { i32, [2 x i32] } { i32 1, [2 x i32] [i32 13, i32 15] }
14 char f();
15 #ifdef FAIL1
16 A c = { f(), { f(), f() } }; // expected-error {{cannot compile this flexible array initializer yet}}
17 #endif
18 #ifdef FAIL2
19 void g() {
20 static A d = { f(), { f(), f() } }; // expected-error {{cannot compile this flexible array initializer yet}}
22 #endif
23 #ifdef FAIL3
24 struct B { int x; char y; char z[]; };
25 B e = {f(), f(), f(), f()}; // expected-error {{cannot compile this flexible array initializer yet}}
26 #endif
27 #ifdef FAIL4
28 union { char a[]; } z = {};
29 union { char a[]; } z0 = {z.a[0]}; // expected-error {{cannot compile this flexible array initializer yet}}
30 char keep() { return z0.a[0]; }
31 #endif
33 namespace zero_initializer {
34 A a0{0, 0}, a1{0, {0, 0}};
35 // CHECK: @_ZN16zero_initializer2a0E = global { i32, [1 x i32] } zeroinitializer,
36 // CHECK: @_ZN16zero_initializer2a1E = global { i32, [2 x i32] } zeroinitializer,
38 struct S { int x[]; };
40 S s{0};
41 // CHECK: @_ZN16zero_initializer1sE = global { [1 x i32] } zeroinitializer,