Bug 24653 – Keyword ordering inconsistency of `auto ref`

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-07-09T09:04:02Z
Last change time
2024-08-19T10:50:05Z
Assigned to
No Owner
Creator
Bolpat

Comments

Comment #0 by qs.il.paperinik — 2024-07-09T09:04:02Z
For most, `auto ref` is a 2-token keyword, but at most places, it’s not required that `auto` and `ref` be in a particular order or next to each other. This is a valid function template declaration: ```d void f()(ref const auto int) { } ``` There’s one exception to this: Lambda returns. Lambdas require `auto ref` in this order. Either the latter should be relaxed or `auto ref` should be required in this order for all uses. While relaxing the lambdas would be the obvious non-breaking change, maybe insisting on `auto ref` is actually the desirable option. Probably very, very little code uses `ref auto` or something other than `auto ref` (considering `ref auto` has very few hits on the Forum).
Comment #1 by nick — 2024-08-19T10:50:05Z
> `auto ref` should be required in this order Fixed in https://github.com/dlang/dmd/pull/16783.