[Issue 22130] New: [REG2.080.1][DIP1000] pure factory functions stopped working

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 19 10:22:09 UTC 2021


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

          Issue ID: 22130
           Summary: [REG2.080.1][DIP1000] pure factory functions stopped
                    working
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ag0aep6g at gmail.com

Relevant forum thread:
https://forum.dlang.org/post/rkqepmhiizlzshhivblf@forum.dlang.org
Needs `-preview=dip1000` (`-dip1000` in older compilers).
Fails since 2.080.1 according to run.dlang.io.

Should work because `f` is a "pure factory function" [1]:

----
int* f(const int* input) pure nothrow @safe
{
    int* output;
    return output;
}
void main() pure nothrow @safe
{
    int* c = new int;
    immutable int* i = f(c);
}
----

[1] https://dlang.org/spec/function.html#pure-functions

--


More information about the Digitalmars-d-bugs mailing list