Currently, associative arrays' byKey and byValue methods do not return forward ranges (although this was the intention). The isForwardRange check fails. The cause can be reduced to the following code: struct R { R save() { return this; } } void main() { R r1 = void; static assert (is(typeof(r1.save) == typeof(r1))); } The compiler complains: test.d(9): Error: static assert (is(R() == R)) is false Note the parens in "R() == R". The problem goes away, if either r1.save is replaced with r1.save(), or the save method declaration is annotated with @property (despite the -property switch not being used).
See also here, someone else got bitten by this problem too: http://forum.dlang.org/post/safrphnyjhbryejzkbzu@forum.dlang.org
https://github.com/D-Programming-Language/druntime/pull/925
(In reply to Vladimir Panteleev from comment #0) > Currently, associative arrays' byKey and byValue methods do not return > forward ranges (although this was the intention). The isForwardRange check > fails. (In reply to hsteoh from comment #2) > https://github.com/D-Programming-Language/druntime/pull/925 Change the "Component" field because it's druntime issue.
Commit pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/38eee4cdf371ca9ab49962d2dfadbfb5785d7bcb Merge pull request #925 from quickfur/issue11761 Fix 11761: aa.byKey and aa.byValue are not forward ranges.
(In reply to Vladimir Panteleev from comment #0) > The cause can be reduced to the following code: > > struct R > { > R save() { return this; } > } > > void main() > { > R r1 = void; > static assert (is(typeof(r1.save) == typeof(r1))); > } > > The compiler complains: > > test.d(9): Error: static assert (is(R() == R)) is false > > Note the parens in "R() == R". > > The problem goes away, if either r1.save is replaced with r1.save(), or the > save method declaration is annotated with @property (despite the -property > switch not being used). The compiler behavior issue is now filed in bug 13293.
Thanks. Link: issue 13293