Bug 9823 – Delegate accepting element not accepted in std.range.put

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-03-27T22:26:00Z
Last change time
2013-11-22T18:23:44Z
Keywords
pull
Assigned to
nobody
Creator
Jesse.K.Phillips+D

Comments

Comment #0 by Jesse.K.Phillips+D — 2013-03-27T22:26:28Z
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.
Comment #1 by yebblies — 2013-07-27T22:33:23Z
*** Issue 10571 has been marked as a duplicate of this issue. ***
Comment #2 by yebblies — 2013-07-27T22:44:53Z
Comment #3 by yebblies — 2013-11-22T18:23:44Z