Skip to content

[SR-11153] Segmentation fault: 11 when using multiple protocols with Self constraints #53550

@swift-ci

Description

@swift-ci
Previous ID SR-11153
Radar rdar://problem/53257826
Original Reporter Qbyte (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

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

Additional Detail from JIRA
Votes 2
Component/s Compiler
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: 1cfc1409d7950524b30cb3f47f9f9e83

Issue 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 }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of software

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions