Skip to content

Commit 66da0bf

Browse files
committed
added some more info
1 parent dd4d780 commit 66da0bf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

documentation/cxx-interop/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,12 @@ object.doSomething()
12591259

12601260
When a C++ type inherits from a `SWIFT_SHARED_REFERENCE` base type, the Swift compiler automatically infers `SWIFT_SHARED_REFERENCE` annotation for the derived type.
12611261
The derived type also gets imported as a reference type, and uses the same `retain` and `release` functions as its base class.
1262+
This inference works as long as all the annotated base types in the inheritance chain (including multiple or indirect inheritance) have the same `retain` and `release` functions.
1263+
If multiple base types have conflicting `retain` or `release` functions, the derived type is imported as a Swift value type, and the compiler emits a warning.
1264+
1265+
1266+
Note that this inference currently applies only to `SWIFT_SHARED_REFERENCE`.
1267+
It does not apply to types annotated with `SWIFT_IMMORTAL_REFERENCE` or `SWIFT_UNSAFE_REFERENCE`.
12621268

12631269
### Inheritance and Virtual Member Functions
12641270

0 commit comments

Comments
 (0)