mirror of
https://github.com/apple/swift.git
synced 2026-10-22 19:15:50 +02:00
Two issues caused compiler crashes when iterating over containers of FRTs: - The subscript setter and iterator pointee setter assumed operator[] and operator*() return UnsafeMutablePointer<T>, but FRT collapses T& to bare T (a class type), leading to an invalid setter body that crashes during SIL verification. - Containers with raw pointer begin()/end() returning FRT* had the similarly stripped to FRT?, which triggered a downstream conformance check failure for UnsafeCxxInputIterator. This patch bails out of the setter synthesis and conformance derivation when this happens, and adds tests for both std::vector<FRT*> and std::vector<FRT>, as well as a custom container with begin() and end() return FRT *. Known issue: using both vector<FRT> and vector<FRT*> for the same FRT in one compilation unit crashes due to a separate bug where the conformance checker creates duplicate CxxSequence conformances. rdar://180479293
28 lines
762 B
Swift
28 lines
762 B
Swift
// RUN: %target-swift-ide-test -print-module -module-to-print=FrtSequence \
|
|
// RUN: -I %S/Inputs -source-filename=x -cxx-interoperability-mode=default \
|
|
// RUN: | %FileCheck %s
|
|
|
|
// FRT types are imported as Swift classes.
|
|
// CHECK: class ImmortalNode {
|
|
// CHECK: var value: Int32
|
|
// CHECK: }
|
|
|
|
// CHECK: class ImmortalNode2 {
|
|
// CHECK: var value: Int32
|
|
// CHECK: }
|
|
|
|
// CHECK: class SharedNode {
|
|
// CHECK: var value: Int32
|
|
// CHECK: func retain()
|
|
// CHECK: func release()
|
|
// CHECK: }
|
|
|
|
// CHECK: func makeImmortalPtrVector()
|
|
// CHECK: func makeSharedPtrVector()
|
|
// CHECK: func makeImmortalValVector()
|
|
|
|
// CHECK: struct RawPtrIterContainer {
|
|
// CHECK: func __beginUnsafe() -> ImmortalNode!
|
|
// CHECK: func __endUnsafe() -> ImmortalNode!
|
|
// CHECK: }
|