www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8310] New: writeln of Range of fixed size array

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc



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: -------
Jun 27 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8310


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
           Platform|x86                         |All
         OS/Version|Windows                     |All



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

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




Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/6c781f1ecf59a332ce842f7369aa3247a43956a0
fix Issue 8310 - writeln of Range of fixed size array

https://github.com/D-Programming-Language/phobos/commit/886c384ba90016cb5b8e7491743d3e88bfa8f481


Issue 8310 - writeln of Range of fixed size array

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


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 28 2012