File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ Name: NoncopyableStructs
3
+ Tags:
4
+ - Name: NonCopyableWithAPINotesDeinit
5
+ SwiftCopyable: false
6
+ SwiftDestroyOp: freeNonCopyableWithAPINotesDeinit
Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ typedef struct SWIFT_NONCOPYABLE_WITH_DESTROY(freeNonCopyableWithDeinit) NonCopy
8
8
void * storage ;
9
9
} NonCopyableWithDeinit ;
10
10
11
+ typedef struct NonCopyableWithAPINotesDeinit {
12
+ void * storage ;
13
+ } NonCopyableWithAPINotesDeinit ;
14
+
11
15
typedef struct __attribute__((swift_attr ("destroy:freeCopyableType" ))) CopyableType {
12
16
void * storage ;
13
17
} CopyableType ;
@@ -29,6 +33,7 @@ extern "C" {
29
33
#endif
30
34
31
35
void freeNonCopyableWithDeinit (NonCopyableWithDeinit ncd );
36
+ void freeNonCopyableWithAPINotesDeinit (NonCopyableWithAPINotesDeinit ncd );
32
37
void freeCopyableType (CopyableType ct );
33
38
34
39
Original file line number Diff line number Diff line change @@ -26,11 +26,17 @@ func testNC() {
26
26
let nc = NonCopyable ( ) // expected-error{{'nc' consumed more than once}}
27
27
consumeNC ( nc) // expected-note{{consumed here}}
28
28
29
+ let ncAPI = NonCopyableWithAPINotesDeinit ( ) // expected-error{{consumed more than once}}
30
+ consumeNCAPI ( ncAPI) // expected-note{{consumed here}}
31
+
29
32
#if ERRORS
30
33
consumeNC ( nc) // expected-note{{consumed again here}}
34
+ consumeNCAPI ( ncAPI) // expected-note{{consumed again here}}
31
35
#endif
32
36
}
33
37
38
+ func consumeNCAPI( _ nc: consuming NonCopyableWithAPINotesDeinit ) { }
39
+
34
40
func consumeNCWithDeinit( _ nc: consuming NonCopyableWithDeinit ) { }
35
41
36
42
func testNCWithDeinit( ) {
You can’t perform that action at this time.
0 commit comments