www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6841] New: writeln problem with array of tuples

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

           Summary: writeln problem with array of tuples
           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



A D2 program:

import std.stdio, std.typecons;
void main() {
    Tuple!(const(char))[] a1;
    Tuple!(immutable(char))[] a2;
    writeln(a1, a2);
}


DMD 2.056head gives:

...\dmd2\src\phobos\std\format.d(1657): Error: static assert 
(isInputRange!(Tuple!(const(char))[])) is false
...\dmd2\src\phobos\std\format.d(2032):        instantiated from here:
formatValue!(LockingTextWriter,Tuple!(const(char))[],char)
...\dmd2\src\phobos\std\format.d(313):        instantiated from here:
formatGeneric!(LockingTextWriter,Tuple!(const(char))[],immutable(char))
...\dmd2\src\phobos\std\stdio.d(678):        instantiated from here:
formattedWrite!(LockingTextWriter,immutable(char),Tuple!(const(char))[])
...\dmd2\src\phobos\std\stdio.d(1511):        instantiated from here:
write!(Tuple!(const(char))[],Tuple!(immutable(char))[],char)
temp.d(5):        instantiated from here:
writeln!(Tuple!(const(char))[],Tuple!(immutable(char))[])

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 22 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6841


Kasumi Hanazuki <k.hanazuki gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |k.hanazuki gmail.com



PDT ---
This problem reduces to the following case,
where dmd rejects ref to struct type with a const field, with error:
    std/array.d(460): Error: a[0u] isn't mutable

I think this is a compiler bug.

----

import std.array;
struct A {
   const(char) c;
}
void main() {
   A[] aa;
   aa.front;
}

// ref T front(T)(T[] a)
// if (!isNarrowString!(T[]) && !is(T[] == void[]))
// {
//     assert(a.length, "Attempting to fetch the front of an empty array of " ~
//                      typeof(a[0]).stringof);
//     return a[0];  // ** std/array.d(460)
// }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 26 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6841


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Phobos                      |DMD





 I think this is a compiler bug.
Thank you for your reduction. Then I have modified the 'component' of this bug report from Phobos to DMD. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 26 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6841


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |FIXED



10:16:57 PST ---
OP sample now works. If there is some other compiler problem please file a new
bug (I don't see this error either "std/array.d(460): Error: a[0u] isn't
mutable").

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




The root cause is bug 6336, and was already fixed in 2.061head.

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