[Issue 24653] New: Keyword ordering inconsistency of `auto ref`

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 9 09:04:02 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24653

          Issue ID: 24653
           Summary: Keyword ordering inconsistency of `auto ref`
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: qs.il.paperinik at gmail.com

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).

--


More information about the Digitalmars-d-bugs mailing list