You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
swift-ci opened this issue
Feb 12, 2018
· 6 comments
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of software
If you have a simple enum which is RawRepresentable and call .rawValue on it, it crashes the compiler on release builds. The following code will crash the compiler, only if you have a RELEASE (optimized build).
// Must be in a separate fileenumAEnum: RawRepresentable {
caseainit?(rawValue: RawValue) {
self = .a
}
varrawValue: String {
return"a"
}
}
// In a different fileletmyEnum = AEnum.a.rawValue
To reproduce, opened the attach project and build for the simulator (it's already set to be a release build).
The text was updated successfully, but these errors were encountered:
Hm, seems to be fixed in master, but also didn't reproduce on Swift 4.0.0. It's possible the reduced test case you've attached lost the actual problem.
Looks like it no longer crashes on master, but it still doesn't work:
/Users/jrose/Downloads/LowercasedSegFault-2/LowercasedSegFault/File.swift:14:21: error: reference to invalid associated type 'RawValue' of type 'AEnum'
init?(rawValue: RawValue) {
^
You can work around this by writing String explicitly instead.
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of software
Attachment: Download
Environment
Version 9.2 (9C40b)
Simulator or device (both reproduce the bug)
Additional Detail from JIRA
md5: 1385af2a973363f13a1ab0c99e9f213f
Issue Description:
If you have a simple enum which is RawRepresentable and call .rawValue on it, it crashes the compiler on release builds. The following code will crash the compiler, only if you have a RELEASE (optimized build).
To reproduce, opened the attach project and build for the simulator (it's already set to be a release build).
The text was updated successfully, but these errors were encountered: