dmd/changelog/dmd.auto-ref-adjacent.dd
2024-08-25 08:43:53 +08:00

18 lines
506 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 `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;
}
---