[Issue 8310] New: writeln of Range of fixed size array
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jun 27 05:18:52 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8310
Summary: writeln of Range of fixed size array
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2012-06-27 05:21:17 PDT ---
import std.stdio: writeln;
import std.algorithm: map;
import std.array: array;
void main() {
char[2] two = ['a', 'b'];
auto pieces = [1, 2].map!(x => two)();
writeln(pieces.array());
}
It gives an acceptable output (dmd 2.060alpha):
["ab", "ab"]
But printing the lazy range itself fails:
import std.stdio: writeln;
import std.algorithm: map;
void main() {
char[2] two = ['a', 'b'];
auto pieces = [1, 2].map!(x => two)();
writeln(pieces);
}
...\dmd2\src\phobos\std\format.d(1978): Error: template std.format.formatValue
does not match any function template declaration
...\dmd2\src\phobos\std\format.d(1203): Error: template std.format.formatValue
cannot deduce template function from argument types
!()(LockingTextWriter,char[2u],FormatSpec!(char))
...\dmd2\src\phobos\std\format.d(2006): Error: template std.format.formatValue
does not match any function template declaration
...\dmd2\src\phobos\std\format.d(1203): Error: template std.format.formatValue
cannot deduce template function from argument types
!()(LockingTextWriter,char[2u],FormatSpec!(char))
...\dmd2\src\phobos\std\format.d(2474): Error: template instance
std.format.formatRange!(LockingTextWriter,Result,char) error instantiating
...\dmd2\src\phobos\std\format.d(2761): instantiated from here:
formatValue!(LockingTextWriter,Result,char)
...\dmd2\src\phobos\std\format.d(420): instantiated from here:
formatGeneric!(LockingTextWriter,Result,char)
...\dmd2\src\phobos\std\stdio.d(683): instantiated from here:
formattedWrite!(LockingTextWriter,char,Result)
...\dmd2\src\phobos\std\stdio.d(1594): instantiated from here:
write!(Result,char)
test.d(6): instantiated from here: writeln!(Result)
...\dmd2\src\phobos\std\format.d(2761): Error: template instance
std.format.formatValue!(LockingTextWriter,Result,char) error instantiating
...\dmd2\src\phobos\std\format.d(420): instantiated from here:
formatGeneric!(LockingTextWriter,Result,char)
...\dmd2\src\phobos\std\stdio.d(683): instantiated from here:
formattedWrite!(LockingTextWriter,char,Result)
...\dmd2\src\phobos\std\stdio.d(1594): instantiated from here:
write!(Result,char)
test.d(6): instantiated from here: writeln!(Result)
...\dmd2\src\phobos\std\format.d(420): Error: template instance
std.format.formatGeneric!(LockingTextWriter,Result,char) error instantiating
...\dmd2\src\phobos\std\stdio.d(683): instantiated from here:
formattedWrite!(LockingTextWriter,char,Result)
...\dmd2\src\phobos\std\stdio.d(1594): instantiated from here:
write!(Result,char)
test.d(6): instantiated from here: writeln!(Result)
...\dmd2\src\phobos\std\stdio.d(683): Error: template instance
std.format.formattedWrite!(LockingTextWriter,char,Result) error instantiating
...\dmd2\src\phobos\std\stdio.d(1594): instantiated from here:
write!(Result,char)
test.d(6): instantiated from here: writeln!(Result)
...\dmd2\src\phobos\std\stdio.d(1594): Error: template instance
std.stdio.File.write!(Result,char) error instantiating
test.d(6): instantiated from here: writeln!(Result)
test.d(6): Error: template instance std.stdio.writeln!(Result) error
instantiating
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list