alias restriction??!
Paul Backus
snarwin at gmail.com
Sun Jul 19 12:08:07 UTC 2020
On Saturday, 18 July 2020 at 18:46:16 UTC, Carl Sturtivant wrote:
> Here's a toy version of a problem in the wild.
>
> struct S {
> long first;
> union T {
> long one;
> double two;
> }
> T second;
> alias First = first;
> alias Second = second.one;
> }
>
> void main() {
> S x;
> x.First = 4;
> x.Second = 5; // compilation error: "Error: need this for
> one of type long"
> }
Easiest workaround:
ref inout(long) Second() inout { return second.one; }
More information about the Digitalmars-d-learn
mailing list