diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-11-14 07:36:28 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-11-14 07:36:28 +0000 |
| commit | 5fa94b09b475fecf06b507c73152fac0d95f3236 (patch) | |
| tree | 8d15c59e3bf8333e137b76ce665ce8ae956f4154 /clang/test/CodeGenCXX | |
| parent | 4f6a2c4acb5142fda7c5c10f99618cd9de3aff18 (diff) | |
| download | bcm5719-llvm-5fa94b09b475fecf06b507c73152fac0d95f3236.tar.gz bcm5719-llvm-5fa94b09b475fecf06b507c73152fac0d95f3236.zip | |
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
Diffstat (limited to 'clang/test/CodeGenCXX')
| -rw-r--r-- | clang/test/CodeGenCXX/cxx11-special-members.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/cxx11-special-members.cpp b/clang/test/CodeGenCXX/cxx11-special-members.cpp new file mode 100644 index 00000000000..59461f9e2f4 --- /dev/null +++ b/clang/test/CodeGenCXX/cxx11-special-members.cpp @@ -0,0 +1,32 @@ +// 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_( |

