1 // RUN: %clang_cc1 -emit-llvm %s -o - -triple=i686-pc-win32 -mconstructor-aliases -fno-rtti | FileCheck %s
2 
3 #include <stdarg.h>
4 
5 struct A {
6   A(int a) : a(a) {}
7   A(const A &o) : a(o.a) {}
8   ~A() {}
9   int a;
10 };
11 
12 int foo(A a, ...) {
13   va_list ap;
14   va_start(ap, a);
15   int sum = 0;
16   for (int i = 0; i < a.a; ++i)
17     sum += va_arg(ap, int);
18   va_end(ap);
19   return sum;
20 }
21 
22 int main() {
23   return foo(A(3), 1, 2, 3);
24 }
25 // CHECK-LABEL: define i32 @main()
26 // CHECK: %[[argmem_cast:[^ ]*]] = bitcast <{ %struct.A, i32, i32, i32 }>* %argmem to <{ %struct.A }>*
27 // CHECK: call i32 (<{ %struct.A }>*, ...)* @"\01?foo@@YAHUA@@ZZ"(<{ %struct.A }>* inalloca %[[argmem_cast]])
28