Reputation: 31
I'm developing an application and I encountered a crash that I can't explain.
The library is fairly complex so I prepared a minimum example
struct Info {
static let test = 1
}
class SuperCls<A> {}
class Cls<A>: SuperCls<A> {
let v: Info.Type = Info.self
}
let v = Cls<Int>()
This code crashes when I alloc the class, in the very last line, with the following error
file:///play.playground/: error: Playground execution aborted: error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=1, address=0x4403).
I also tried this in an xcode project and the error is pretty much the same
I found a way to make this code works
struct Info {
static let test = 1
}
class SuperCls<A> {}
class Cls<A>: SuperCls<A> {
var v: Info.Type?
override init() {
v = Info.self
super.init()
}
}
let v = Cls<Int>()
Can someone tell me why this crash occurs? Thanks!
UPDATE
I also discovered that this works
struct Info {
let test = 1
}
class SuperCls<A> {}
class Cls<A>: SuperCls<A> {
let v = Info()
}
let v = Cls<Int>()
The problem seems to be related to the fact that I'm using Info
as a type and accessing static information
Upvotes: 2
Views: 607
Reputation: 31
Alright, it seems that it is a bug in Xcode beta 5
Thanks for the help
Upvotes: 1