[Issue 17661] New isInputRange rejects valid input range
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Jul 17 16:01:31 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17661
--- Comment #2 from hsteoh at quickfur.ath.cx ---
Haha, I tried doing that but ran into another bug:
------
struct C {
private S* impl;
}
struct S {
bool empty;
@property C front() return { return C(&this); }
void popFront() { }
pragma(msg, typeof((S r) return => r.front));
}
------
Compiler output (dmd -dip25 -dip1000):
------
test.d(10): Error: returning r.front() escapes a reference to parameter r,
perhaps annotate with return
_error_
------
Because of this, isInputRange still doesn't work, with your proposed change.
Apparently dmd fails to pick up the `return` annotation for some reason. Which
is actually rather strange, because:
-------
pragma(msg, typeof((int* r) return => r));
-------
prints:
-------
int* function(return int* r) pure nothrow @nogc return @safe
-------
so obviously the syntax is correct, and at least some of the time dmd is able
to process it correctly. I've no idea why it doesn't pick up the annotation
and/or process it correctly when in the first code snippet above.
--
More information about the Digitalmars-d-bugs
mailing list