title: Segmentation fault Xcode 11
body: <p>Segmentation error appears while serializing 'AnyArrayBox'</p>
  
  <ol start="2">
  <li>While running pass #0 SILModuleTransform "SerializeSILPass".</li>
  <li>While serializing 'AnyArrayBox' (in module 'Module')
  0  swift                    0x000000010d7abeb3 PrintStackTraceSignalHandler(void*) + 51
  1  swift                    0x000000010d7ab686 SignalHandler(int) + 358
  2  libsystem_platform.dylib 0x00007fff76c31b5d _sigtramp + 29</li>
  </ol>
  
  <p>Here is the AnyArray struct</p>
  
  <pre><code>    struct AnyArray&lt;Element&gt;: RandomAccessCollection {
  
      typealias Index = Int
  
      private let box: AnyArrayBase&lt;Element&gt;
  
      init&lt;Concrete: RandomAccessCollection&gt;(_ concrete: Concrete) where Concrete.Element == Element, Concrete.Indices == Indices {
          box = AnyArrayBox(concrete)
      }
  
      var startIndex: Int { return box.startIndex }
      var endIndex: Int { return box.endIndex }
  
      func index(after i: Int) -&gt; Int {
          return box.index(after: i)
      }
  
      subscript(position: Index) -&gt; Element {
          return box[position]
      }
  
  }
  </code></pre>
  
  <p>And two others which is used in there</p>
  
  <pre><code>private class AnyArrayBase&lt;Element&gt;: RandomAccessCollection {
  
      init() {
          guard type(of: self) != AnyArrayBase.self else {
              fatalError("_AnyArrayBase&lt;Element&gt; is an abstract class, it can not be created; create subclass instance instead")
          }
      }
  
      typealias Index = Int
  
      var startIndex: Int { fatalError("Must override") }
      var endIndex: Int { fatalError("Must override") }
  
      func index(after i: Int) -&gt; Int {
          fatalError("Must override")
      }
  
      subscript(position: Index) -&gt; Element {
          fatalError("Must override")
      }
  
  }
  
  private final class AnyArrayBox&lt;Concrete: RandomAccessCollection&gt;: AnyArrayBase&lt;Concrete.Element&gt; where Concrete.Indices == AnyArrayBase&lt;Concrete.Element&gt;.Indices {
  
      private let concrete: Concrete
  
      init(_ concrete: Concrete) {
          self.concrete = concrete
      }
  
      override var startIndex: Int { return concrete.startIndex }
      override var endIndex: Int { return concrete.endIndex }
  
      override func index(after i: Int) -&gt; Int {
          return concrete.index(after: i)
      }
  
      override subscript(position: Index) -&gt; Element {
          return concrete[position]
      }
  
  }
  </code></pre>
  
  <p>How can I fix it? Any recommendations?</p>