mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This fixes a crash at runtime when destroying a Swift array of values of a C++ foreign reference type. Swift optimizes the amount of metadata emitted for `_ContiguousArrayStorage<Element>` by reusing `_ContiguousArrayStorage<AnyObject>` whenever possible (see `getContiguousArrayStorageType`). However, C++ foreign reference types are not `AnyObject`s, since they have custom retain/release operations. This change disables the `_ContiguousArrayStorage` metadata optimization for C++ reference types, which makes sure that `swift_arrayDestroy` will call the correct release operation for elements of `[MyCxxRefType]`. rdar://127154770
984 B
984 B