Require adjacent auto ref return as well (#21061)

This commit is contained in:
Dennis 2025-03-22 22:59:00 +01:00 committed by GitHub
parent 8a96c4745c
commit 31bfe613b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 34 additions and 9 deletions

View file

@ -0,0 +1,12 @@
Keywords `auto` and `ref` must be adjacent for `auto ref` return.
Similar to `auto ref` parameters in 2.111, it's now deprecated to declare an `auto ref` return type without putting those two keywords next to each other as well.
---
ref auto int f() => 3;
auto { ref int g() => 3; }
// Correction:
auto ref f() => 3;
auto ref g() => 3;
---