blob: 5e81ba1ff9d88df75a9d797101360f2cec23e46d [file] [log] [blame]
Ulrich Weigand35668cc2012-10-24 12:22:56 +00001// RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 -S -emit-llvm -o - %s | FileCheck %s
Eli Friedman576cbd02012-02-29 00:00:28 +00002
Richard Smithd82a2ce2012-12-21 03:17:28 +00003// CHECK: @[[THREE_NULL_MEMPTRS:.*]] = private constant [3 x i32] [i32 -1, i32 -1, i32 -1]
4
Eli Friedman576cbd02012-02-29 00:00:28 +00005struct A { int a[1]; };
6typedef A x[];
7int 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.)
Richard Smithd82a2ce2012-12-21 03:17:28 +000012 return 0;
13}
14
15namespace 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 }
Eli Friedman576cbd02012-02-29 00:00:28 +000050}