[SR-1378] String with format initializer crashes when using repeated positional arguments #43987
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
crash
Bug: A crash, i.e., an abnormal termination of software
good first issue
Good for newcomers
run-time crash
Bug → crash: Swift code crashed during execution
SDKOverlay
standard library
Area: Standard library umbrella
Environment
Xcode Playground Version 7.3 (7D175)
Additional Detail from JIRA
md5: 2e6524377155b4334bb8be3466516cc5
Issue Description:
This:
print(String(format: "%2$@ %1$@ %2$@", "bar", "foo"))
crashes with EXC_BAD_INSTRUCTION
while NSString:
print(NSString(format: "%2$@ %1$@ %2$@", "bar", "foo"))
prints "foo bar foo" as expected
Also note that adding an extra argument:
print(String(format: "%2$@ %1$@ %2$@", "bar", "foo", "dummy")
does not crash and prints "foo bar foo"
The text was updated successfully, but these errors were encountered: