Skip to content

Commit 53979a2

Browse files
committed
[cxx-interop] More tests for move-only C++ types
1 parent 35e474d commit 53979a2

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

test/Interop/Cxx/class/type-classification-module-interface.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,5 @@
4444
// CHECK: func __getIteratorBoxUnsafe() -> IteratorBox
4545
// CHECK-SKIP-UNSAFE-NOT: func __getIteratorBoxUnsafe() -> IteratorBox
4646
// CHECK: }
47+
48+
// CHECK: struct StructCopyableMovableAnnotatedNonCopyable

test/Interop/Cxx/class/type-classification-typechecker.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,23 @@
33
import TypeClassification
44

55
func test() {
6+
let x = StructWithPointerNonCopyableTriviallyMovable()
7+
let v = copy x // expected-error {{'copy' cannot be applied to noncopyable types}}
8+
_ = v
9+
}
10+
11+
func testField() {
12+
let x = StructWithPointerNonCopyableTriviallyMovableField()
13+
let v = copy x // expected-error {{'copy' cannot be applied to noncopyable types}}
14+
_ = v
15+
}
16+
17+
func testAnnotated() {
618
let x = StructCopyableMovableAnnotatedNonCopyable()
719
let v = copy x // expected-error {{'copy' cannot be applied to noncopyable types}}
820
_ = v
921
}
1022

1123
test()
24+
testField()
25+
testAnnotated()

0 commit comments

Comments
 (0)