diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2013-09-10 05:14:39 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2013-09-10 05:14:39 +0000 |
commit | b39be1f38eddb47f2898fed512901e6f27aeb45e (patch) | |
tree | 239880ff0e5a81f312819700cb0f9b4526ec910b /clang/test/CodeGenCXX/move-assignment.cpp | |
parent | e2622c2accc2e865f31a497b62f9bfebf84690f4 (diff) | |
download | bcm5719-llvm-b39be1f38eddb47f2898fed512901e6f27aeb45e.tar.gz bcm5719-llvm-b39be1f38eddb47f2898fed512901e6f27aeb45e.zip |
Generate code for the move assignment operator using memcpy, the same as we do
for the copy assignment operator.
llvm-svn: 190385
Diffstat (limited to 'clang/test/CodeGenCXX/move-assignment.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/move-assignment.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/move-assignment.cpp b/clang/test/CodeGenCXX/move-assignment.cpp new file mode 100644 index 00000000000..3653eab6b7d --- /dev/null +++ b/clang/test/CodeGenCXX/move-assignment.cpp @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -emit-llvm -std=c++11 -o - %s -triple x86_64-pc-linux-gnu | FileCheck %s + +struct A { + A &operator=(A&&); +}; + +struct B { + A a; + int i; + bool b; + char c; + long l; + float f; +}; + +void test1() { + B b1, b2; + b1 = static_cast<B&&>(b2); +} + +// CHECK-LABEL: define {{.*}} @_ZN1BaSEOS_ +// CHECK: call {{.*}} @_ZN1AaSEOS_ +// CHECK-NOT: store +// CHECK: call {{.*}}memcpy{{.*}}, i64 24 +// CHECK-NOT: store +// CHECK: ret |