Open
Description
Description
The compiler prevents me from using an expression macro with an inout parameter, with cyclical errors that I can't resolve. When I try to use my macro that has an inout parameter, I get this error: '&' may only be used to pass an argument to inout parameter
, and after removing it, I see Passing value of type 'Int' to an inout parameter requires explicit '&'
.
Reproduction
Macro definition:
@freestanding(expression)
public macro test(_ input: inout Int) = #externalMacro(...)
Use site 1:
#test(&a) // '&' may only be used to pass an argument to inout parameter
Use site 2:
#test(a) // Passing value of type 'Int' to an inout parameter requires explicit '&'
Expected behavior
Compilation with the &
inout syntax allowed.
Environment
swift-driver version: 1.127.5.3 Apple Swift version 6.2 (swiftlang-6.2.0.10.914 clang-1700.3.10.902)
Target: arm64-apple-macosx26.0
Additional information
No response