[Issue 23243] New: std.range.isInfinite should accept ranges with non-static empty methods
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jul 13 02:07:45 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23243
Issue ID: 23243
Summary: std.range.isInfinite should accept ranges with
non-static empty methods
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: snarwin+bugzilla at gmail.com
As of DMD 2.100.0, the following program fails to compile:
---
import std.range.primitives;
struct R
{
int front() { return 42; }
bool empty() { return false; }
void popFront() {}
}
static assert(isInputRange!R); // ok
enum e = R().empty; // ok
static assert(isInfinite!R); // fails
---
Since R is an input range whose .empty property evaluates to false at compile
time, it should be accepted as an infinite range.
This issue blocks issue 23242.
--
More information about the Digitalmars-d-bugs
mailing list