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-LABEL: 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: [[V:%.*]] = alloca [[V:%.*]]*, 17 // CHECK-NEXT: [[TMP:%.*]] = alloca [[A]] 18 // CHECK-NEXT: [[CLEANUPACTIVE:%.*]] = alloca i1 19 // CHECK: call void @_ZN5test01AC1Ev([[A]]* [[Y]]) 20 // CHECK-NEXT: invoke void @_ZN5test01AC1Ev([[A]]* [[Z]]) 21 // CHECK: [[NEW:%.*]] = invoke i8* @_Znwm(i64 1) 22 // CHECK: store i1 true, i1* [[CLEANUPACTIVE]] 23 // CHECK: [[NEWCAST:%.*]] = bitcast i8* [[NEW]] to [[V]]* 24 // CHECK-NEXT: invoke void @_ZN5test01AC1Ev([[A]]* [[TMP]]) 25 // CHECK: invoke void @_ZN5test01VC1ERKNS_1AE([[V]]* [[NEWCAST]], [[A]]* dereferenceable({{[0-9]+}}) [[TMP]]) 26 // CHECK: store i1 false, i1* [[CLEANUPACTIVE]] 27 // CHECK-NEXT: invoke void @_ZN5test01AD1Ev([[A]]* [[TMP]]) 28 A y; 29 try { 30 A z; 31 V *v = new V(); 32 33 if (x) return 1; 34 } catch (int ex) { 35 return 1; 36 } 37 return 0; 38 } 39 40 int test() { 41 return test<0>(5); 42 } 43 } 44