summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/copy-constructor-synthesis-2.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-04-29 19:26:57 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-04-29 19:26:57 +0000
commit419bd0941514bad6fa9d66e6f76360791389e7e0 (patch)
treeeac43af91c8b6458ab4dc6478c239e12534894fd /clang/test/CodeGenCXX/copy-constructor-synthesis-2.cpp
parentae7e4995ca2c506200f7673d9161df2d851582fb (diff)
downloadbcm5719-llvm-419bd0941514bad6fa9d66e6f76360791389e7e0.tar.gz
bcm5719-llvm-419bd0941514bad6fa9d66e6f76360791389e7e0.zip
PR23373: A defaulted union copy constructor that is not trivial must still be
emitted as a memcpy. llvm-svn: 236142
Diffstat (limited to 'clang/test/CodeGenCXX/copy-constructor-synthesis-2.cpp')
-rw-r--r--clang/test/CodeGenCXX/copy-constructor-synthesis-2.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/clang/test/CodeGenCXX/copy-constructor-synthesis-2.cpp b/clang/test/CodeGenCXX/copy-constructor-synthesis-2.cpp
index dc9ca23cdf9..4bea685dbf2 100644
--- a/clang/test/CodeGenCXX/copy-constructor-synthesis-2.cpp
+++ b/clang/test/CodeGenCXX/copy-constructor-synthesis-2.cpp
@@ -1,4 +1,24 @@
-// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++11 -emit-llvm -o - %s | FileCheck %s
+
+union PR23373 {
+ PR23373(PR23373&) = default;
+ PR23373 &operator=(PR23373&) = default;
+ int n;
+ float f;
+};
+extern PR23373 pr23373_a;
+
+PR23373 pr23373_b(pr23373_a);
+// CHECK-LABEL: define {{.*}} @__cxx_global_var_init(
+// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64({{.*}} @pr23373_b{{.*}}, {{.*}} @pr23373_a{{.*}}, i64 4, i32 4, i1 false)
+
+PR23373 pr23373_f() { return pr23373_a; }
+// CHECK-LABEL: define {{.*}} @_Z9pr23373_fv(
+// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64({{.*}}, i64 4, i32 4, i1 false)
+
+void pr23373_g(PR23373 &a, PR23373 &b) { a = b; }
+// CHECK-LABEL: define {{.*}} @_Z9pr23373_g
+// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64({{.*}}, i64 4, i32 4, i1 false)
struct A { virtual void a(); };
A x(A& y) { return y; }
OpenPOWER on IntegriCloud