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
Xcode 10.3:
Apple Swift version 5.0.1 (swiftlang-1001.0.82.4 clang-1001.0.46.5)
Target: x86_64-apple-darwin18.7.0
Xcode 11:
Apple Swift version 5.1 (swiftlang-1100.0.266.1 clang-1100.0.32.1)
Target: x86_64-apple-darwin18.7.0
Xcode 12.2:
Apple Swift version 5.3.1 (swiftlang-1200.0.41 clang-1200.0.32.8)
Target: x86_64-apple-darwin20.1.0
Additional Detail from JIRA
Votes
0
Component/s
Foundation
Labels
Bug
Assignee
None
Priority
Medium
md5: 263244286731725b695bee9ab16124cf
Issue Description:
The following Swift code crashes at runtime:
import Foundation
extensionData{mutatingfunc modify(){
for (i, byte) in enumerated(){
switch byte {case0x2D:self[i]=0x2B// '-' -> '+'default: break
}}}}letdata=Data("ey-LCJ1.z7n-unids".utf8)letparts= data.split(separator:0x2E)// dotvarmutable=parts[1]// index 0 works
mutable.modify()
Environment
Xcode 10.3:
Apple Swift version 5.0.1 (swiftlang-1001.0.82.4 clang-1001.0.46.5)
Target: x86_64-apple-darwin18.7.0
Xcode 11:
Apple Swift version 5.1 (swiftlang-1100.0.266.1 clang-1100.0.32.1)
Target: x86_64-apple-darwin18.7.0
Xcode 12.2:
Apple Swift version 5.3.1 (swiftlang-1200.0.41 clang-1200.0.32.8)
Target: x86_64-apple-darwin20.1.0
Additional Detail from JIRA
md5: 263244286731725b695bee9ab16124cf
Issue Description:
The following Swift code crashes at runtime:
Output:
Update (2020-11-30)
After @belkadan's comment, I've modified the code to use
indices
instead ofenumerated
. The crash still occurs:The text was updated successfully, but these errors were encountered: