We can't have alias of instantiated auto ref functions?

Yuxuan Shui via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Mar 18 03:35:00 PDT 2017


auto a(T)(auto ref T t) {
	return t;
}
void main() {
	alias tmp = a!int;
	import std.stdio;
	writeln(tmp(10));
}

This gives this error message:
test.d(1): Error: 'auto' can only be used as part of 'auto ref' 
for template function parameters

Which is rather useless, and I have to dig into the code to find 
out why: the only way to instantiate a auto ref function is to 
call it. I think this is rather inconvenient.


More information about the Digitalmars-d-learn mailing list