http://d.puremagic.com/issues/show_bug.cgi?id=4704
Summary: Problems with aa.byValue() Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2010-08-21 10:31:18 PDT --- This correct D2 program: import std.stdio: writeln; void main() { int[int] aa = [1:2, 3:4, 5:6]; auto vals = aa.byValue(); foreach (v; vals) writeln(v); } Outputs with dmd 2.048: 2 4 6 ------------------- But this other program: import std.stdio: writeln; void main() { int[int] aa = [1:2, 3:4, 5:6]; auto vals = aa.byValue(); writeln(vals); } writeln() seems unable to print them: ...\dmd\src\phobos\std\format.d(1364): Error: template std.format.formatValue(Writer,T,Char) if (is(const(T) == const(void[]))) does not match any function template declaration ...\dmd\src\phobos\std\format.d(1364): Error: template std.format.formatValue(Writer,T,Char) if (is(const(T) == const(void[]))) cannot deduce template function from argument types !()(LockingTextWriter,int delegate(int delegate(ref int) dg),FormatSpec!(immutable(char))) ...\dmd\src\phobos\std\format.d(305): Error: template instance std.format.formatGeneric!(LockingTextWriter,int delegate(int delegate(ref int) dg),immutable(char)) error instantiating ...\dmd\src\phobos\std\stdio.d(595): instantiated from here: formattedWrite!(LockingTextWriter,immutable(char),int delegate(int delegate(ref int) dg)) ...\dmd\src\phobos\std\stdio.d(1372): instantiated from here: write!(int delegate(int delegate(ref int) dg),char) test.d(6): instantiated from here: writeln!(int delegate(int delegate(ref int) dg)) ------------------- And the array() of dmd 2.048 seems unable to create an array (maybe this is already fixed in SVN): import std.array: array; void main() { int[int] aa = [1:2, 3:4, 5:6]; auto vals = aa.byValue(); int[] avals = array(vals); } test.d(5): Error: template std.array.array(Range) if (isInputRange!(Range)) does not match any function template declaration test.d(5): Error: template std.array.array(Range) if (isInputRange!(Range)) cannot deduce template function from argument types !()(int delegate(int delegate(ref int) dg)) Similar problems are present with .byKey(). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------