www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20031] New: Tuple.toString does not work with mutable toString

https://issues.dlang.org/show_bug.cgi?id=20031

          Issue ID: 20031
           Summary: Tuple.toString does not work with mutable toString
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: timon.gehr gmx.ch

DMD64 D Compiler v2.086.0:

import std.stdio, std.typecons;
struct S{
    string toString(){ return "not broken"; }
}
void main(){
    writeln(S()); // "not broken"
    writeln(tuple(S(),S())); // "Tuple!(S, S)(const(S)(), const(S)())"
}

The second writeln should print: "Tuple!(S, S)(not broken, not broken)"

--
Jul 06 2019