xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/implicit-copy-assign-operator.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin10.0.0 -o - %s | FileCheck %s
2f4a2713aSLionel Sambuc struct A {
3f4a2713aSLionel Sambuc   A &operator=(const A&);
4f4a2713aSLionel Sambuc   A &operator=(A&);
5f4a2713aSLionel Sambuc };
6f4a2713aSLionel Sambuc 
7f4a2713aSLionel Sambuc struct B {
8f4a2713aSLionel Sambuc   B &operator=(B&);
9f4a2713aSLionel Sambuc };
10f4a2713aSLionel Sambuc 
11f4a2713aSLionel Sambuc struct C {
12f4a2713aSLionel Sambuc   virtual C& operator=(const C&);
13f4a2713aSLionel Sambuc };
14f4a2713aSLionel Sambuc 
15f4a2713aSLionel Sambuc struct POD {
16f4a2713aSLionel Sambuc   int array[3][4];
17f4a2713aSLionel Sambuc };
18f4a2713aSLionel Sambuc 
19f4a2713aSLionel Sambuc struct CopyByValue {
20f4a2713aSLionel Sambuc   CopyByValue(const CopyByValue&);
21f4a2713aSLionel Sambuc   CopyByValue &operator=(CopyByValue);
22f4a2713aSLionel Sambuc };
23f4a2713aSLionel Sambuc 
24f4a2713aSLionel Sambuc struct D : A, B, virtual C {
25f4a2713aSLionel Sambuc   int scalar;
26f4a2713aSLionel Sambuc   int scalar_array[2][3];
27f4a2713aSLionel Sambuc   B class_member;
28f4a2713aSLionel Sambuc   C class_member_array[2][3];
29f4a2713aSLionel Sambuc   POD pod_array[2][3];
30f4a2713aSLionel Sambuc 
31f4a2713aSLionel Sambuc   union {
32f4a2713aSLionel Sambuc     int x;
33f4a2713aSLionel Sambuc     float f[3];
34f4a2713aSLionel Sambuc   };
35f4a2713aSLionel Sambuc 
36f4a2713aSLionel Sambuc   CopyByValue by_value;
37f4a2713aSLionel Sambuc };
38f4a2713aSLionel Sambuc 
test_D(D d1,D d2)39f4a2713aSLionel Sambuc void test_D(D d1, D d2) {
40f4a2713aSLionel Sambuc   d1 = d2;
41f4a2713aSLionel Sambuc }
42f4a2713aSLionel Sambuc 
43*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define linkonce_odr dereferenceable({{[0-9]+}}) %struct.D* @_ZN1DaSERS_
44f4a2713aSLionel Sambuc // CHECK: {{call.*_ZN1AaSERS_}}
45f4a2713aSLionel Sambuc // CHECK: {{call.*_ZN1BaSERS_}}
46f4a2713aSLionel Sambuc // CHECK: {{call.*_ZN1CaSERKS_}}
47f4a2713aSLionel Sambuc // CHECK: {{call void @llvm.memcpy.p0i8.p0i8.i64.*i64 28}}
48f4a2713aSLionel Sambuc // CHECK: {{call.*_ZN1BaSERS_}}
49f4a2713aSLionel Sambuc // CHECK: br
50f4a2713aSLionel Sambuc // CHECK: {{call.*_ZN1CaSERKS_}}
51f4a2713aSLionel Sambuc // CHECK: {{call void @llvm.memcpy.p0i8.p0i8.i64.*i64 288}}
52f4a2713aSLionel Sambuc // CHECK: {{call void @llvm.memcpy.p0i8.p0i8.i64.*i64 12}}
53f4a2713aSLionel Sambuc // CHECK: call void @_ZN11CopyByValueC1ERKS_
54f4a2713aSLionel Sambuc // CHECK: {{call.*_ZN11CopyByValueaSES_}}
55f4a2713aSLionel Sambuc // CHECK: ret
56