2012-11-14 15:36:28 +08:00
|
|
|
// RUN: %clang_cc1 %s -std=c++11 -emit-llvm -o - -triple=i686-linux-gnu | FileCheck %s
|
|
|
|
|
|
|
|
struct A {
|
|
|
|
A(const A&);
|
|
|
|
A &operator=(const A&);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct B {
|
|
|
|
A a;
|
|
|
|
B(B&&) = default;
|
|
|
|
B &operator=(B&&) = default;
|
|
|
|
};
|
|
|
|
|
|
|
|
// CHECK: define {{.*}} @_Z2f1
|
|
|
|
void f1(B &x) {
|
|
|
|
// CHECK-NOT: memcpy
|
|
|
|
// CHECK: call {{.*}} @_ZN1BC1EOS_(
|
|
|
|
B b(static_cast<B&&>(x));
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: define {{.*}} @_Z2f2
|
|
|
|
void f2(B &x, B &y) {
|
|
|
|
// CHECK-NOT: memcpy
|
|
|
|
// CHECK: call {{.*}} @_ZN1BaSEOS_(
|
|
|
|
x = static_cast<B&&>(y);
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: define {{.*}} @_ZN1BaSEOS_(
|
|
|
|
// CHECK: call {{.*}} @_ZN1AaSERKS_(
|
|
|
|
|
2014-09-26 04:55:00 +08:00
|
|
|
// rdar://18309639 {
|
|
|
|
template<int> struct C { C() = default; };
|
|
|
|
struct D {
|
|
|
|
C<0> c;
|
|
|
|
D() { }
|
|
|
|
};
|
|
|
|
template struct C<0>; // was asserting
|
|
|
|
void f3() {
|
|
|
|
C<0> a;
|
|
|
|
D b;
|
|
|
|
}
|
2017-11-17 07:54:56 +08:00
|
|
|
// Trivial default ctor, might or might not be defined, but we must not expect
|
2019-02-22 03:11:15 +08:00
|
|
|
// someone else to define it.
|
2017-11-17 07:54:56 +08:00
|
|
|
// CHECK-NOT: declare {{.*}} @_ZN1CILi0EEC1Ev
|
2014-09-26 04:55:00 +08:00
|
|
|
// CHECK: define {{.*}} @_ZN1DC1Ev
|
|
|
|
|
2012-11-14 15:36:28 +08:00
|
|
|
// CHECK: define {{.*}} @_ZN1BC2EOS_(
|
|
|
|
// CHECK: call {{.*}} @_ZN1AC1ERKS_(
|