[Issue 12639] Struct-scoped import breaks UFCS

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Apr 24 23:03:31 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12639

monarchdodra at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra at gmail.com

--- Comment #1 from monarchdodra at gmail.com ---
Strange. I had thought it had something to do with "array" name collision. But
the situation is the same with, say "replicate":

auto x = foo[].replicate(5);  //FAIL
auto x = replicate(foo[], 5); //OK

In any case, here is a somewhat simplified test case. We don't need nested
structs to trigger it:

//----
struct Range
{
    import std.array;
    int front() @property { return 10; }
    void popFront() { counter++; }
    bool empty() @property { return counter >= 10; }
private:
    int counter;
}

void main(string[] args)
{
   import std.stdio;
   import std.array;
   Range r;
   auto x1 = array(r);
   auto x2 = r.array();
   writeln(x);
}
//----

--


More information about the Digitalmars-d-bugs mailing list