1 // RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 -S -emit-llvm -o - %s | FileCheck %s 2 3 // CHECK: @[[THREE_NULL_MEMPTRS:.*]] = private constant [3 x i32] [i32 -1, i32 -1, i32 -1] 4 5 struct A { int a[1]; }; 6 typedef A x[]; 7 int f() { 8 x{{{1}}}; 9 // CHECK: define i32 @_Z1fv 10 // CHECK: store i32 1 11 // (It's okay if the output changes here, as long as we don't crash.) 12 return 0; 13 } 14 15 namespace ValueInitArrayOfMemPtr { 16 struct S {}; 17 typedef int (S::*p); 18 typedef p a[3]; 19 void f(const a &); 20 21 struct Agg1 { 22 int n; 23 p x; 24 }; 25 26 struct Agg2 { 27 int n; 28 a x; 29 }; 30 31 struct S1 { 32 p x; 33 S1(); 34 }; 35 36 // CHECK: define void @_ZN22ValueInitArrayOfMemPtr1fEi 37 void f(int n) { 38 Agg1 a = { n }; 39 // CHECK: store i32 -1, 40 41 Agg2 b = { n }; 42 // CHECK: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %{{.*}}, i8* bitcast ([3 x i32]* @[[THREE_NULL_MEMPTRS]] to i8*), i32 12, i32 4, i1 false) 43 } 44 45 // CHECK: define void @_ZN22ValueInitArrayOfMemPtr1gEv 46 void g() { 47 // CHECK: store i32 -1, 48 f(a{}); 49 } 50 } 51