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