Uploaded image for project: 'Swift'
  1. Swift
  2. SR-11153

Segmentation fault: 11 when using multiple protocols with Self constraints

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Compiler
    • Labels:
    • Environment:

      Xcode 11.0 beta 3, beta 4 and beta 5 using "Swift 5" as "Swift Language Version"

      Description

      The following code produces a Segmentation fault: 11:

      protocol VectorSpace {
      	associatedtype Field: FieldAlgebra
      }
      
      protocol FieldAlgebra: VectorSpace where Self.Field == Self {
      	associatedtype ComparableSubalgebra: ComparableFieldAlgebra
      	static var zero: Self { get }
      }
      
      protocol ComparableFieldAlgebra: FieldAlgebra where Self.ComparableSubalgebra == Self {
      }
      
      func test<F: FieldAlgebra>(_ f: F) {
      	_ = F.ComparableSubalgebra.zero
      }
      

      It still produces the Segmentation fault if you change the protocol FieldAlgebra to

      protocol FieldAlgebra: VectorSpace {
      	typealias Field = Self
      	associatedtype ComparableSubalgebra: ComparableFieldAlgebra
      	static var zero: Self { get }
      }
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Qbyte Maximilian H├╝nenberger
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: