1// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i686-pc-win32 -mconstructor-aliases -fno-rtti | FileCheck %s
2
3struct A {
4  A() : a(42) {}
5  A(const A &o) : a(o.a) {}
6  ~A() {}
7  int a;
8  A foo(A o);
9};
10
11A A::foo(A x) {
12  A y(*this);
13  y.a += x.a;
14  return y;
15}
16
17// CHECK-LABEL: define x86_thiscallcc %struct.A* @"\01?foo@A@@QAE?AU1@U1@@Z"
18// CHECK:       (%struct.A* %this, <{ %struct.A*, %struct.A }>* inalloca)
19// CHECK:   getelementptr inbounds <{ %struct.A*, %struct.A }>* %{{.*}}, i32 0, i32 0
20// CHECK:   load %struct.A**
21// CHECK:   ret %struct.A*
22
23int main() {
24  A x;
25  A y = x.foo(x);
26}
27
28// CHECK: call x86_thiscallcc %struct.A* @"\01?foo@A@@QAE?AU1@U1@@Z"
29// CHECK:       (%struct.A* %{{[^,]*}}, <{ %struct.A*, %struct.A }>* inalloca %{{[^,]*}})
30