llvm-capstone/clang/test/CodeGenCXX/cxx11-special-members.cpp
Richard Smith 5fa94b09b4 PR14279: Work around this major miscompilation by treating move operations as
non-trivial if they would not call a move operation, even if they would in fact
call a trivial copy operation. A proper fix is to follow, but this small
directed fix is intended for porting to the 3.2 release branch.

llvm-svn: 167920
2012-11-14 07:36:28 +00:00

33 lines
651 B
C++

// 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_(
// CHECK: define {{.*}} @_ZN1BC2EOS_(
// CHECK: call {{.*}} @_ZN1AC1ERKS_(