This code doesn't compile: struct R { bool empty(); ref int front(); void popFront(); } ref int popNext(ref R fwdRange) { auto result = & fwdRange.front(); fwdRange.popFront; return *result; } void main() { R r; int x = r.popNext; } The code should work: popNext should be looked up in R's outer scope if not a member.
Added keyword, error message is as follows. C:> dmd test.d test.d(18): Error: no property 'popNext' for type 'R'
Invisible first paramter? Not with a one-parameter function?
Seems to work now.