[Issue 18563] context pointer inside structs constness problems

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 19 08:43:00 UTC 2018


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

Timoses <timosesu at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timosesu at gmail.com

--- Comment #1 from Timoses <timosesu at gmail.com> ---
Related: https://forum.dlang.org/post/rxolioihwfrljpfjfmxw@forum.dlang.org

// dmd v2.081.1
unittest {
    struct S {
        uint value;
        ~this() pure {
        }
    }
    S makeS() pure
    {
        S s = S();
        return s;
    }
    // Error: cannot implicitly convert expression makeS() of type S to
immutable(S)
    immutable S s = makeS();
}

Without the destructor compiles fine.

Perhaps a better error message could be found.

Further related issue: https://issues.dlang.org/show_bug.cgi?id=18567

--


More information about the Digitalmars-d-bugs mailing list