46 lines · cpp
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 %s2// 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 %s3 4// Reduced from a crash on boost::interprocess's node_allocator_test.cpp.5namespace test0 {6 struct A { A(); ~A(); };7 struct V { V(const A &a = A()); ~V(); };8 9 // CHECK-LABEL: define linkonce_odr noundef i32 @_ZN5test04testILi0EEEii10 template<int X> int test(int x) {11 // CHECK: [[RET:%.*]] = alloca i3212 // CHECK-NEXT: [[X:%.*]] = alloca i3213 // CHECK-NEXT: [[Y:%.*]] = alloca [[A:%.*]],14 // CHECK-NEXT: [[Z:%.*]] = alloca [[A]]15 // CHECK-NEXT: [[EXN:%.*]] = alloca ptr16 // CHECK-NEXT: [[SEL:%.*]] = alloca i3217 // CHECK-NEXT: [[V:%.*]] = alloca ptr,18 // CHECK-NEXT: [[TMP:%.*]] = alloca [[A]]19 // CHECK-NEXT: [[CLEANUPACTIVE:%.*]] = alloca i120 // 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]]27 28 // CHECK98-NEXT: invoke void @_ZN5test01AD1Ev(ptr {{[^,]*}} [[TMP]])29 // CHECK11-NEXT: call void @_ZN5test01AD1Ev(ptr {{[^,]*}} [[TMP]])30 A y;31 try {32 A z;33 V *v = new V();34 35 if (x) return 1;36 } catch (int ex) {37 return 1;38 }39 return 0;40 }41 42 int test() {43 return test<0>(5);44 }45}46