refInt = ref int: how to achieve this? or is this a bug?

mw mingwu at gmail.com
Wed Jun 17 20:38:46 UTC 2020


----------------
import std.stdio;

alias refInt = ref int;

void f(refInt i) {
   i = 456;
}

void main() {
   int i = 123;
   writeln(i);
   f(i);
   writeln(i);
}
----------------

$ $DMD/windows/bin64/rdmd.exe reft.d
123
123

$ $LDC/bin/rdmd  reft.d
123
123

How to achieve this typdef/alias that what I want?

Thanks.


More information about the Digitalmars-d mailing list