[Issue 15027] cannot pass arguments of type DirEntry to std.file functions

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Oct 2 17:23:42 PDT 2015


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

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com

--- Comment #3 from Walter Bright <bugzilla at digitalmars.com> ---
(In reply to Rainer Schuetze from comment #2)
> The main problem is that DirEntry does not qualify as an InputRange, because
> the aliased property returns an rvalue. This cannot be passed to popFront
> through UFCS as it expectes a ref argument.

I think this is correct. If you remove the 'ref' from 'popFront', it works. It
also works if DirEntry is defined as:

    string name;
    alias name this;

i.e. then 'name' becomes an lvalue. popFront() cannot update an rvalue.

--


More information about the Digitalmars-d-bugs mailing list