www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21660] New: [REG 2.066.0] cannot convert unique

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

          Issue ID: 21660
           Summary: [REG 2.066.0] cannot convert unique immutable(int)**
                    to immutable
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ag0aep6g gmail.com

This is a spin-off from issue 17635.

Should compile:

----
alias T = immutable int;

T** f(I)(const I input) pure
{
    T** output;
    return output;
}

void main()
{
    /* Not regressions in 2.066 (i.e. 2.065 also rejected these): */

    T*** a1;
    immutable T** r1 = f(a1);

    static struct S2 { T* foo; }
    S2* a2;
    immutable T** r2 = f(a2);

    /* But this one compiles with 2.065, so it's a regression: */

    static struct S3 { T foo; }
    S3* a3;
    immutable T** r3 = f(a3);
}
----

--
Feb 24 2021