Skip to content

Commit 9071c82

Browse files
authored
Merge pull request #70765 from apple/egorzhdan/move-only-tests
[cxx-interop] More tests for move-only C++ types
2 parents a159604 + 53979a2 commit 9071c82

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
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
Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
1-
// Test various aspects of the C++ `nodiscard` keyword.
2-
31
// RUN: %target-typecheck-verify-swift -I %S/Inputs -cxx-interoperability-mode=upcoming-swift
42

53
import TypeClassification
64

75
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() {
818
let x = StructCopyableMovableAnnotatedNonCopyable()
919
let v = copy x // expected-error {{'copy' cannot be applied to noncopyable types}}
1020
_ = v
1121
}
1222

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

0 commit comments

Comments
 (0)