You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Swift validates the retain/release operations for foreign reference types to check for obvious errors, e.g. a wrong parameter type or return type.
That logic was only running for C++ foreign reference types. This patch enables it for C foreign reference types as well.
rdar://158609723
// CHECK: error: cannot find retain function 'nonexistent' for reference type 'NonExistent'
6
+
// CHECK: error: cannot find release function 'nonexistent' for reference type 'NonExistent'
7
+
publicfunc test(x:NonExistent){}
8
+
9
+
// CHECK: error: reference type 'NoRetainRelease' must have 'retain:' Swift attribute
10
+
// CHECK: error: reference type 'NoRetainRelease' must have 'release:' Swift attribute
11
+
publicfunc test(x:NoRetainRelease){}
12
+
13
+
// CHECK: error: specified retain function 'badRetain' is invalid; retain function must either return have 'void', the reference count as an integer, or the parameter type
14
+
// CHECK: error: specified release function 'badRelease' is invalid; release function must have exactly one argument of type 'BadRetainRelease'
0 commit comments