www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15604] New: std.array.array on nested structs, weird corner

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

          Issue ID: 15604
           Summary: std.array.array on nested structs, weird corner case.
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: john.loughran.colvin gmail.com

% cat test.d
void foo()
{
    import std.array;
    [A()].array;
}

struct A
{
    void opAssign(T)(T v) {}
    Object o = new Object;
}

% dmd test.d
/usr/local/Cellar/dmd/HEAD/include/d2/std/conv.d(3970): Error: cannot
implicitly convert expression (S(A(Object()))) of type S to immutable(S)
/usr/local/Cellar/dmd/HEAD/include/d2/std/conv.d(3934): Error: template
instance std.conv.emplaceInitializer!(S) error instantiating
/usr/local/Cellar/dmd/HEAD/include/d2/std/array.d(125):        instantiated
from here: emplaceRef!(A, A, A)
arrayBug.d(4):        instantiated from here: array!(A[])
/usr/local/Cellar/dmd/HEAD/include/d2/std/array.d(128): Error: forward
reference to inferred return type of function call () => cast(E[])result()

This regression was introduced by
https://github.com/D-Programming-Language/phobos/pull/3805

--
Jan 25