1 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fcxx-exceptions -fexceptions -emit-llvm -std=c++98 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK98 %s
2 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fcxx-exceptions -fexceptions -emit-llvm -std=c++11 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s
4 // Reduced from a crash on boost::interprocess's node_allocator_test.cpp.
6 struct A
{ A(); ~A(); };
7 struct V
{ V(const A
&a
= A()); ~V(); };
9 // CHECK-LABEL: define linkonce_odr noundef i32 @_ZN5test04testILi0EEEii
10 template<int X
> int test(int x
) {
11 // CHECK: [[RET:%.*]] = alloca i32
12 // CHECK-NEXT: [[X:%.*]] = alloca i32
13 // CHECK-NEXT: [[Y:%.*]] = alloca [[A:%.*]],
14 // CHECK-NEXT: [[Z:%.*]] = alloca [[A]]
15 // CHECK-NEXT: [[EXN:%.*]] = alloca ptr
16 // CHECK-NEXT: [[SEL:%.*]] = alloca i32
17 // CHECK-NEXT: [[V:%.*]] = alloca ptr,
18 // CHECK-NEXT: [[TMP:%.*]] = alloca [[A]]
19 // CHECK-NEXT: [[CLEANUPACTIVE:%.*]] = alloca i1
20 // CHECK: call void @_ZN5test01AC1Ev(ptr {{[^,]*}} [[Y]])
21 // CHECK-NEXT: invoke void @_ZN5test01AC1Ev(ptr {{[^,]*}} [[Z]])
22 // CHECK: [[NEW:%.*]] = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 1)
23 // CHECK: store i1 true, ptr [[CLEANUPACTIVE]]
24 // CHECK-NEXT: invoke void @_ZN5test01AC1Ev(ptr {{[^,]*}} [[TMP]])
25 // CHECK: invoke void @_ZN5test01VC1ERKNS_1AE(ptr {{[^,]*}} [[NEW]], ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[TMP]])
26 // CHECK: store i1 false, ptr [[CLEANUPACTIVE]]
28 // CHECK98-NEXT: invoke void @_ZN5test01AD1Ev(ptr {{[^,]*}} [[TMP]])
29 // CHECK11-NEXT: call void @_ZN5test01AD1Ev(ptr {{[^,]*}} [[TMP]])