aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/copy-constructor-synthesis.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-08-21 18:30:26 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-08-21 18:30:26 +0000
commiteb0b6d556ff2b4a5053e89fd084eb34e44cea14c (patch)
treedd7c01ab6cd422153f3b5ee274b534e4f9fd155a /test/CodeGenCXX/copy-constructor-synthesis.cpp
parent666a91edc949f5b52eeef481601e2a60de4fdebe (diff)
Patch to provide ir-gen support in copying array members
when synthesizing a copy constructor. Arrays's base element may have a trivial or non-trivial copy constructor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79653 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/copy-constructor-synthesis.cpp')
-rw-r--r--test/CodeGenCXX/copy-constructor-synthesis.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/CodeGenCXX/copy-constructor-synthesis.cpp b/test/CodeGenCXX/copy-constructor-synthesis.cpp
index 121fd41b5c..2fe196d694 100644
--- a/test/CodeGenCXX/copy-constructor-synthesis.cpp
+++ b/test/CodeGenCXX/copy-constructor-synthesis.cpp
@@ -57,6 +57,36 @@ struct X : M, N, P { // ...
};
};
+static int ix = 1;
+// class with user-defined copy constructor.
+struct S {
+ S() : iS(ix++) { }
+ S(const S& arg) { *this = arg; }
+ int iS;
+};
+
+// class with trivial copy constructor.
+struct I {
+ I() : iI(ix++) { }
+ int iI;
+};
+
+struct XM {
+ XM() { }
+ double dXM;
+ S ARR_S[3][4][2];
+ void pr() {
+ for (unsigned i = 0; i < 3; i++)
+ for (unsigned j = 0; j < 4; j++)
+ for (unsigned k = 0; k < 2; k++)
+ printf("ARR_S[%d][%d][%d] = %d\n", i,j,k, ARR_S[i][j][k].iS);
+ for (unsigned i = 0; i < 3; i++)
+ for (unsigned k = 0; k < 2; k++)
+ printf("ARR_I[%d][%d] = %d\n", i,k, ARR_I[i][k].iI);
+ }
+ I ARR_I[3][2];
+};
+
int main()
{
X a;
@@ -65,6 +95,10 @@ int main()
X x;
X c(x);
c.pr();
+
+ XM m0;
+ XM m1 = m0;
+ m1.pr();
}
// CHECK-LP64: .globl __ZN1XC1ERK1X
// CHECK-LP64: .weak_definition __ZN1XC1ERK1X