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
88 void * storage ;
99} NonCopyableWithDeinit ;
1010
11+ typedef struct NonCopyableWithAPINotesDeinit {
12+ void * storage ;
13+ } NonCopyableWithAPINotesDeinit ;
14+
1115typedef struct __attribute__((swift_attr ("destroy:freeCopyableType" ))) CopyableType {
1216 void * storage ;
1317} CopyableType ;
@@ -29,6 +33,7 @@ extern "C" {
2933#endif
3034
3135void freeNonCopyableWithDeinit (NonCopyableWithDeinit ncd );
36+ void freeNonCopyableWithAPINotesDeinit (NonCopyableWithAPINotesDeinit ncd );
3237void freeCopyableType (CopyableType ct );
3338
3439
Original file line number Diff line number Diff line change @@ -26,11 +26,17 @@ func testNC() {
2626 let nc = NonCopyable ( ) // expected-error{{'nc' consumed more than once}}
2727 consumeNC ( nc) // expected-note{{consumed here}}
2828
29+ let ncAPI = NonCopyableWithAPINotesDeinit ( ) // expected-error{{consumed more than once}}
30+ consumeNCAPI ( ncAPI) // expected-note{{consumed here}}
31+
2932 #if ERRORS
3033 consumeNC ( nc) // expected-note{{consumed again here}}
34+ consumeNCAPI ( ncAPI) // expected-note{{consumed again here}}
3135 #endif
3236}
3337
38+ func consumeNCAPI( _ nc: consuming NonCopyableWithAPINotesDeinit ) { }
39+
3440func consumeNCWithDeinit( _ nc: consuming NonCopyableWithDeinit ) { }
3541
3642func testNCWithDeinit( ) {
You can’t perform that action at this time.
0 commit comments