Skip to content

Commit 0548af8

Browse files
committed
[cxx-interop] Add documentation about inferring SWIFT_SHARED_REFERENCE in c++ inheritance
1 parent 838b4f1 commit 0548af8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

documentation/cxx-interop/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,6 +1255,9 @@ object.doSomething()
12551255
// `object` will be released here.
12561256
```
12571257

1258+
### Inference for Derived Types
1259+
Swift compiler automatically infers the ```SWIFT_SHARED_REFERENCE``` annotation for C++ types that inherit from a base type annotated with ```SWIFT_SHARED_REFERENCE```. These derived types are imported as Swift reference types or Swift class types that use the same ```retain``` and ```release``` functions as the base type. No additional annotation is required on the derived types.
1260+
12581261
### Inheritance and Virtual Member Functions
12591262

12601263
Similar to value types, casting an instance of a derived reference type to a

0 commit comments

Comments
 (0)