1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s 2 struct X { 3 X(); 4 ~X(); 5 }; 6 7 struct Y { 8 Y(); 9 ~Y(); 10 }; 11 12 // CHECK-LABEL: define void @_Z1fiPPKc( 13 void f(int argc, const char* argv[]) { 14 // CHECK: call void @_ZN1XC1Ev 15 X x; 16 // CHECK: call i8* @llvm.stacksave( 17 const char *argv2[argc]; 18 // CHECK: call void @_ZN1YC1Ev 19 Y y; 20 for (int i = 0; i != argc; ++i) 21 argv2[i] = argv[i]; 22 23 // CHECK: call void @_ZN1YD1Ev 24 // CHECK: call void @llvm.stackrestore 25 // CHECK: call void @_ZN1XD1Ev 26 // CHECK: ret void 27 } 28 29 namespace PR11744 { 30 // Make sure this doesn't crash; there was a use-after-free issue 31 // for this testcase. 32 template<typename T> int f(int n) { 33 T arr[3][n]; 34 return 3; 35 } 36 int test = f<int>(0); 37 } 38