1 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fcxx-exceptions -fexceptions -emit-llvm -o - | FileCheck %s 2 3 // Reduced from a crash on boost::interprocess's node_allocator_test.cpp. 4 namespace test0 { 5 struct A { A(); ~A(); }; 6 struct V { V(const A &a = A()); ~V(); }; 7 8 // CHECK: define linkonce_odr i32 @_ZN5test04testILi0EEEii 9 template<int X> int test(int x) { 10 // CHECK: [[RET:%.*]] = alloca i32 11 // CHECK-NEXT: [[X:%.*]] = alloca i32 12 // CHECK-NEXT: [[Y:%.*]] = alloca [[A:%.*]], 13 // CHECK-NEXT: [[Z:%.*]] = alloca [[A]] 14 // CHECK-NEXT: [[EXN:%.*]] = alloca i8* 15 // CHECK-NEXT: [[SEL:%.*]] = alloca i32 16 // CHECK-NEXT: alloca i32 17 // CHECK-NEXT: [[V:%.*]] = alloca [[V:%.*]]*, 18 // CHECK-NEXT: [[TMP:%.*]] = alloca [[A]] 19 // CHECK-NEXT: [[CLEANUPACTIVE:%.*]] = alloca i1 20 // CHECK: store i1 true, i1* [[CLEANUPACTIVE]] 21 // CHECK: call void @_ZN5test01AC1Ev([[A]]* [[Y]]) 22 // CHECK-NEXT: invoke void @_ZN5test01AC1Ev([[A]]* [[Z]]) 23 // CHECK: [[NEW:%.*]] = invoke noalias i8* @_Znwm(i64 1) 24 // CHECK: [[NEWCAST:%.*]] = bitcast i8* [[NEW]] to [[V]]* 25 // CHECK-NEXT: invoke void @_ZN5test01AC1Ev([[A]]* [[TMP]]) 26 // CHECK: invoke void @_ZN5test01VC1ERKNS_1AE([[V]]* [[NEWCAST]], [[A]]* [[TMP]]) 27 // CHECK: store i1 false, i1* [[CLEANUPACTIVE]] 28 // CHECK-NEXT: invoke void @_ZN5test01AD1Ev([[A]]* [[TMP]]) 29 A y; 30 try { 31 A z; 32 V *v = new V(); 33 34 if (x) return 1; 35 } catch (int ex) { 36 return 1; 37 } 38 return 0; 39 } 40 41 int test() { 42 return test<0>(5); 43 } 44 } 45