This func-local struct is failing Comparable

This struct Foo, when inside a function, fails Comparable, even though when the exact same definition outside of a function is fine (it gets == from Equatable, of course...)

Is this a bug, or what are the semantics that it is violating? --thanx

func foo() {
struct Foo : Equatable, Comparable {
let x: Int
let y: Int
static func < (lhs: Foo, rhs: Foo) -> Bool {
return lhs.x+lhs.y < rhs.x+rhs.y

This seems to be the known bug SR-3092, which is duplicated by at least seven other bug reports.

Terms of Service

Privacy Policy

Cookie Policy