File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed
test/Interop/Cxx/class/move-only Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -17,10 +17,18 @@ struct NonCopyable {
17
17
x = y;
18
18
return y;
19
19
}
20
- private:
20
+
21
21
int x;
22
22
};
23
23
24
+ struct NonCopyableDerived : public NonCopyable {
25
+ NonCopyableDerived (int x) : NonCopyable(x) {}
26
+ };
27
+
28
+ struct NonCopyableDerivedDerived : public NonCopyableDerived {
29
+ NonCopyableDerivedDerived (int x) : NonCopyableDerived(x) {}
30
+ };
31
+
24
32
struct NonCopyableHolder {
25
33
inline NonCopyableHolder (int x) : x(x) {}
26
34
inline NonCopyableHolder (const NonCopyableHolder &) = delete;
Original file line number Diff line number Diff line change @@ -9,10 +9,28 @@ var MoveOnlyCxxValueType = TestSuite("Move Only Value Types")
9
9
10
10
MoveOnlyCxxValueType . test ( " Test move only type member access " ) {
11
11
var c = NonCopyable ( 2 )
12
- let k = c. method ( - 2 )
12
+ var k = c. method ( - 2 )
13
13
expectEqual ( k, - 4 )
14
14
expectEqual ( c. method ( 1 ) , 2 )
15
+ k = c. x
16
+ expectEqual ( k, 2 )
17
+ c. x = - 3
18
+ expectEqual ( c. x, - 3 )
19
+ k = c. mutMethod ( 72 )
20
+ expectEqual ( k, 72 )
15
21
}
16
22
17
- runAllTests ( )
23
+ MoveOnlyCxxValueType . test ( " Test derived move only type member access " ) {
24
+ var c = NonCopyableDerivedDerived ( 2 )
25
+ var k = c. method ( - 3 )
26
+ expectEqual ( k, - 6 )
27
+ expectEqual ( c. method ( 1 ) , 2 )
28
+ k = c. x
29
+ expectEqual ( k, 2 )
30
+ c. x = 11
31
+ expectEqual ( c. x, 11 )
32
+ k = c. mutMethod ( - 13 )
33
+ expectEqual ( k, - 13 )
34
+ }
18
35
36
+ runAllTests ( )
You can’t perform that action at this time.
0 commit comments