Disappointing inflexibility of argument passing with "alias this"

Carl Sturtivant via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 22 09:22:51 PST 2016


struct Test { int i; alias i this; }
auto testFunct( Test i){ }

void main() {
     Test t;
     t = 1;
     testFunct( 1);
}


The assignment is fine, but the call is rejected by dmd.

See also
http://forum.dlang.org/post/fqfonkcdcjuwbaacqshe@forum.dlang.org



More information about the Digitalmars-d mailing list