[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenCXX / eh-aggregated-inits.cpp
blobcb34b65dfe8e5c14593a660d138810de547b67df
1 // Check that initialization of the only one memcpy-able struct member will not
2 // be performed twice after successful non-trivial initializtion of the second
3 // member.
4 //
5 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -O0 -fno-elide-constructors -emit-llvm %s -o - | FileCheck %s
7 int globId = 0;
9 struct ImplicitCopy {
10 int id;
12 ImplicitCopy() { id = 10; }
13 ~ImplicitCopy() { id = 20; }
16 struct ExplicitCopy {
17 int id;
19 ExplicitCopy() { id = 15; }
20 ExplicitCopy(const ExplicitCopy &x) { id = 25; }
21 ~ExplicitCopy() { id = 35; }
24 struct Container {
25 ImplicitCopy o1; // memcpy-able member.
26 ExplicitCopy o2; // non-trivial initialization.
28 Container() { globId = 1000; }
29 ~Container() { globId = 2000; }
32 int main() {
33 try {
34 Container c1;
35 // CHECK-DAG: call void @llvm.memcpy
36 // CHECK-DAG: declare void @llvm.memcpy
37 // CHECK-NOT: @llvm.memcpy
38 Container c2(c1);
40 return 2;
42 catch (...) {
43 return 1;
45 return 0;