[Issue 9051] Passing an immutable global with post-blit to a CTFE function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 16 11:03:31 UTC 2021


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305 at gmail.com
         Resolution|---                         |WONTFIX

--- Comment #4 from RazvanN <razvan.nitu1305 at gmail.com> ---
The postblit should not be used as it has impossible to fix flaws. Development
for it has halted. The code works if the copy constructor is used:

struct Set{
    uint[] arr;
    this(const ref Set) {} //comment out to make it compile
}

pure auto getMeASet(uint[] arr)
{
    return Set(arr);
}

immutable set = getMeASet([1,2,3,4]);

pure auto getSecond(in Set set)
{
    return set.arr[1];
}

pragma(msg, getSecond(set));

I'm gonna close this as WONTFIX.

--


More information about the Digitalmars-d-bugs mailing list