xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/cxx11-special-members.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -std=c++11 -emit-llvm -o - -triple=i686-linux-gnu | FileCheck %s
2f4a2713aSLionel Sambuc 
3f4a2713aSLionel Sambuc struct A {
4f4a2713aSLionel Sambuc   A(const A&);
5f4a2713aSLionel Sambuc   A &operator=(const A&);
6f4a2713aSLionel Sambuc };
7f4a2713aSLionel Sambuc 
8f4a2713aSLionel Sambuc struct B {
9f4a2713aSLionel Sambuc   A a;
10f4a2713aSLionel Sambuc   B(B&&) = default;
11f4a2713aSLionel Sambuc   B &operator=(B&&) = default;
12f4a2713aSLionel Sambuc };
13f4a2713aSLionel Sambuc 
14f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_Z2f1
f1(B & x)15f4a2713aSLionel Sambuc void f1(B &x) {
16f4a2713aSLionel Sambuc   // CHECK-NOT: memcpy
17f4a2713aSLionel Sambuc   // CHECK: call {{.*}} @_ZN1BC1EOS_(
18f4a2713aSLionel Sambuc   B b(static_cast<B&&>(x));
19f4a2713aSLionel Sambuc }
20f4a2713aSLionel Sambuc 
21f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_Z2f2
f2(B & x,B & y)22f4a2713aSLionel Sambuc void f2(B &x, B &y) {
23f4a2713aSLionel Sambuc   // CHECK-NOT: memcpy
24f4a2713aSLionel Sambuc   // CHECK: call {{.*}} @_ZN1BaSEOS_(
25f4a2713aSLionel Sambuc   x = static_cast<B&&>(y);
26f4a2713aSLionel Sambuc }
27f4a2713aSLionel Sambuc 
28f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_ZN1BaSEOS_(
29f4a2713aSLionel Sambuc // CHECK: call {{.*}} @_ZN1AaSERKS_(
30f4a2713aSLionel Sambuc 
31*0a6a1f1dSLionel Sambuc // rdar://18309639 {
32*0a6a1f1dSLionel Sambuc template<int> struct C { C() = default; };
33*0a6a1f1dSLionel Sambuc struct D {
34*0a6a1f1dSLionel Sambuc   C<0> c;
DD35*0a6a1f1dSLionel Sambuc   D() { }
36*0a6a1f1dSLionel Sambuc };
37*0a6a1f1dSLionel Sambuc template struct C<0>; // was asserting
f3()38*0a6a1f1dSLionel Sambuc void f3() {
39*0a6a1f1dSLionel Sambuc   C<0> a;
40*0a6a1f1dSLionel Sambuc   D b;
41*0a6a1f1dSLionel Sambuc }
42*0a6a1f1dSLionel Sambuc // CHECK: define {{.*}} @_ZN1CILi0EEC1Ev
43*0a6a1f1dSLionel Sambuc // CHECK: define {{.*}} @_ZN1DC1Ev
44*0a6a1f1dSLionel Sambuc 
45f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_ZN1BC2EOS_(
46f4a2713aSLionel Sambuc // CHECK: call {{.*}} @_ZN1AC1ERKS_(
47