1 // RUN: %clang_cc1 -std=c++11 -S -triple x86_64-none-linux-gnu -emit-llvm -o - %s | FileCheck %s
4 typedef decltype(sizeof(int)) size_t;
6 // libc++'s implementation with __size_ replaced by __end_
13 initializer_list(const _E* __b, const _E* __e)
19 typedef _E value_type;
20 typedef const _E& reference;
21 typedef const _E& const_reference;
22 typedef size_t size_type;
24 typedef const _E* iterator;
25 typedef const _E* const_iterator;
27 initializer_list() : __begin_(nullptr), __end_(nullptr) {}
29 size_t size() const {return __end_ - __begin_;}
30 const _E* begin() const {return __begin_;}
31 const _E* end() const {return __end_;}
35 // CHECK: @_ZGR15globalInitList1_ = internal constant [3 x i32] [i32 1, i32 2, i32 3]
36 // CHECK: @globalInitList1 = global {{[^ ]+}} { i32* getelementptr inbounds ([3 x i32], [3 x i32]* @_ZGR15globalInitList1_, {{[^)]*}}), i32*
37 std::initializer_list<int> globalInitList1 = {1, 2, 3};
40 // CHECK-LABEL: define void @_Z3fn1i
42 // CHECK: [[array:%[^ ]+]] = alloca [3 x i32]
43 // CHECK: getelementptr inbounds [3 x i32], [3 x i32]* [[array]], i{{32|64}} 0
44 // CHECK-NEXT: store i32 1, i32*
45 // CHECK-NEXT: getelementptr
47 // CHECK-NEXT: getelementptr
51 // CHECK-NEXT: getelementptr
52 // CHECK-NEXT: getelementptr inbounds [3 x i32], [3 x i32]*
53 // CHECK-NEXT: store i32*
54 // CHECK-NEXT: getelementptr
55 // CHECK-NEXT: getelementptr inbounds [3 x i32], [3 x i32]* [[array]], i{{32|64}} 0, i{{32|64}} 3
56 // CHECK-NEXT: store i32*
57 std::initializer_list<int> intlist{1, 2, i};
69 // CHECK-LABEL: define void @_Z3fn2v
70 void target(std::initializer_list<destroyme1>);
71 // objects should be destroyed before dm2, after call returns
72 target({ destroyme1(), destroyme1() });
73 // CHECK: call void @_ZN10destroyme1D1Ev
75 // CHECK: call void @_ZN10destroyme2D1Ev
79 // CHECK-LABEL: define void @_Z3fn3v
80 // objects should be destroyed after dm2
81 auto list = { destroyme1(), destroyme1() };
83 // CHECK: call void @_ZN10destroyme2D1Ev
84 // CHECK: call void @_ZN10destroyme1D1Ev