diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-11-14 00:50:40 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-11-14 00:50:40 +0000 |
commit | 8c88953ff0cebd861643ab92309aba71d23c306b (patch) | |
tree | 325984252cef025efa030af771233da6a14a977b /test/CodeGenCXX/assign-operator.cpp | |
parent | b8a8de316dade43fff95d7bfd2cfaa367f53faea (diff) |
Remove another questionable use of hasTrivial*. The relevant thing for this
test was whether the /selected/ operator= was trivial, not whether the class
had any trivial (or any non-trivial) operator=s.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167897 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/assign-operator.cpp')
-rw-r--r-- | test/CodeGenCXX/assign-operator.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/test/CodeGenCXX/assign-operator.cpp b/test/CodeGenCXX/assign-operator.cpp index e19df272c9..40695b706e 100644 --- a/test/CodeGenCXX/assign-operator.cpp +++ b/test/CodeGenCXX/assign-operator.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -verify -o - |FileCheck %s +// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - -std=c++11 |FileCheck %s class x { public: int operator=(int); @@ -28,3 +28,27 @@ namespace test1 { A<int> a; } + +// Ensure that we use memcpy when we would have selected a trivial assignment +// operator, even for a non-trivially-copyable type. +struct A { + A &operator=(const A&); +}; +struct B { + B(const B&); + B &operator=(const B&) = default; + int n; +}; +struct C { + A a; + B b[16]; +}; +void b(C &a, C &b) { + // CHECK: define {{.*}} @_ZN1CaSERKS_( + // CHECK: call {{.*}} @_ZN1AaSERKS_( + // CHECK-NOT: call {{.*}} @_ZN1BaSERKS_( + // CHECK: call {{.*}} @{{.*}}memcpy + // CHECK-NOT: call {{.*}} @_ZN1BaSERKS_( + // CHECK: } + a = b; +} |