www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9823] New: Delegate accepting element not accepted in std.range.put

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9823

           Summary: Delegate accepting element not accepted in
                    std.range.put
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: Jesse.K.Phillips+D gmail.com


--- Comment #0 from Jesse Phillips <Jesse.K.Phillips+D gmail.com> 2013-03-27
22:26:28 PDT ---
When providing a delegate to the std.range.put() function, compilation fails.

import std.range;

void main() {
    string[] nameList1 = ["Anders", "David", "James", "Jeff", "Joe"];

    void mySink(in char[] a) { }
    auto r = &mySink;
    static assert(isOutputRange!(typeof(r), string)); // Passes
    put(r, nameList1); // Fails
}

std/range.d(611): Error: static assert  "Cannot put a string[] into a void
delegate(const(char[]) a)"

------

This appears to be an issue of line 597

    else static if ((usingPut || usingFront) && isInputRange!E &&
is(typeof(put(r, e.front))))
    {
        for (; !e.empty; e.popFront()) put(r, e.front);
    }

Where it should be checking (!usingPut && !usingFront) as they refer to
usingPut: Use put method from struct or class.
usingFront: Output range is an InputRange and may accept assignment to front.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 27 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9823


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies gmail.com


--- Comment #1 from yebblies <yebblies gmail.com> 2013-07-28 15:33:23 EST ---
*** Issue 10571 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 27 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9823


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #2 from yebblies <yebblies gmail.com> 2013-07-28 15:44:53 EST ---
Turned into a pull request:

https://github.com/D-Programming-Language/phobos/pull/1437

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 27 2013