www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20070] New: [2.087.0] std.conv.toImpl matches two functions

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

          Issue ID: 20070
           Summary: [2.087.0] std.conv.toImpl matches two functions when
                    using static arrays as inout( T )
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: gooberman gmail.com

Created attachment 1755
  --> https://issues.dlang.org/attachment.cgi?id=1755&action=edit
Error log, obtained from run.dlang.io

Came across this doing some templated serialisation code and keeping const
correctness.

Does not error with slices.

Code:

void writeThem( T )( ref inout( T ) them )
{
    import std.stdio : writeln;
    import std.conv : to;

    writeln( them.to!string );
}

void main()
{
    const( uint )[4] vals = [ 1, 2, 3, 4 ];
    vals.writeThem;
}

--
Jul 21 2019