-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwarekey pathsFeature: key paths (both native and Objective-C)Feature: key paths (both native and Objective-C)run-time crashBug → crash: Swift code crashed during executionBug → crash: Swift code crashed during execution
Description
Previous ID | SR-6096 |
Radar | rdar://problem/34889333 |
Original Reporter | tomquist (JIRA User) |
Type | Bug |
Status | Resolved |
Resolution | Done |
Environment
Apple Swift version 4.0 (swiftlang-900.0.65 clang-900.0.37)
Target: x86_64-apple-macosx10.9
Xcode Version 9.0 (9A235)
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, KeyPaths, RunTimeCrash |
Assignee | tomquist (JIRA) |
Priority | Medium |
md5: 7e5bd566fa2f00a65d781a8dced48556
is duplicated by:
- SR-6110 Runtime crash with nested optional key-path
- SR-6281 Creating KeyPath with Optional Indexing Crashes
- SR-6495 Segfault when using KeyPath on final class in struct with NSObject
relates to:
- SR-6281 Creating KeyPath with Optional Indexing Crashes
Issue Description:
The following code produces a runtime crash:
protocol SomeProtocol {}
struct SomeType: SomeProtocol {}
struct Value<ValueType> {}
extension SomeProtocol {
var asString: String? {
return self as? String
}
}
extension Value where ValueType: SomeProtocol {
func doSomething() {
print(\ValueType.asString?.endIndex)
}
}
Value<SomeType>().doSomething()
Crash:
fatal error: UnsafeMutableRawBufferPointer with negative count
[1] 74901 illegal hardware instruction ./test
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwarekey pathsFeature: key paths (both native and Objective-C)Feature: key paths (both native and Objective-C)run-time crashBug → crash: Swift code crashed during executionBug → crash: Swift code crashed during execution