Using borrowing On String Causes Compiler Error
#69252
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
Description
When using the
borrowingparameter on aStringin an enum initializer the compiler reports the following error:I've attached a code sample demonstrating this behavior in the next section. This error occurs if the scenario is on the same enum with a static function borrowing a
Stringor a regular function.Steps to reproduce
Compiling the following code snippet will produce the error using Swift 5.9:
Expected behavior
The initializer, static function, or member function should be able to borrow a
Stringvalue to ensure the value isn't copied.Environment
The text was updated successfully, but these errors were encountered: