dmd/changelog/dmd.auto-ref-put-adjacent.dd
2025-02-14 08:23:16 +08:00

18 lines
538 B
Text

Keywords `auto` and `ref` must be adjacent
It's now deprecated to declare `auto ref` parameters without putting those two keywords next to each other.
This way it's clear that `auto ref` semantics are intended, rather than `ref` and `auto` semantics separately.
For the newly introduced $(RELATIVE_LINK2 dmd.reflocal, `ref` local / global variables), it's an error immediately.
---
void t()(ref const auto int x) // Deprecation
{
ref auto y = x; // Error
}
// Correction:
void t()(auto ref const int x)
{
auto ref y = x;
}
---