Skip to content

Commit 16b6306

Browse files
authored
Merge pull request #38351 from egorzhdan/cxx-tests-copy-ctor
C++ Interop: tweak subscript operator tests
2 parents ebfb3a5 + 682f162 commit 16b6306

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

test/Interop/Cxx/operators/Inputs/member-inline.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,11 @@ struct IntArrayByVal {
147147

148148
struct NonTrivialIntArrayByVal {
149149
NonTrivialIntArrayByVal(int first) { values[0] = first; }
150-
NonTrivialIntArrayByVal(const NonTrivialIntArrayByVal &other) {}
150+
NonTrivialIntArrayByVal(const NonTrivialIntArrayByVal &other) {
151+
for (int i = 0; i < 5; i++)
152+
values[i] = other.values[i];
153+
}
154+
151155
int operator[](int x) const { return values[x]; }
152156

153157
// For testing purposes.

test/Interop/Cxx/operators/Inputs/member-out-of-line.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ struct ReadWriteIntArray {
3131

3232
struct NonTrivialIntArrayByVal {
3333
NonTrivialIntArrayByVal(int first) { values[0] = first; }
34-
NonTrivialIntArrayByVal(const NonTrivialIntArrayByVal &other) {}
34+
NonTrivialIntArrayByVal(const NonTrivialIntArrayByVal &other) {
35+
for (int i = 0; i < 5; i++)
36+
values[i] = other.values[i];
37+
}
3538
int operator[](int x);
3639

3740
// For testing purposes.

0 commit comments

Comments
 (0)