[Issue 12639] New: Struct-scoped import breaks UFCS
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Apr 24 18:54:44 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12639
Issue ID: 12639
Summary: Struct-scoped import breaks UFCS
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: brian-schott at cox.net
struct Foo
{
Range opSlice() { return Range(); }
static struct Range
{
int front() { return 10; }
void popFront() { counter++; }
bool empty() { return counter >= 10; }
private:
import std.array;
int counter;
}
private:
int bar;
}
void main(string[] args)
{
import std.stdio;
import std.array;
Foo foo;
auto x = foo[].array();
writeln(x);
}
The above example fails to compile. If you remove the "import std.array;" line
from the Range struct, this works as intended. It also works if you write "auto
x = array(foo[]);"
--
More information about the Digitalmars-d-bugs
mailing list