[Issue 23112] New: code passes @nogc, allocates anyway

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 16 07:54:43 UTC 2022


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

          Issue ID: 23112
           Summary: code passes @nogc, allocates anyway
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: su+dlangissues at angel-island.zone

the following code allocates, bypassing @nogc and -vgc.

struct Forward(alias F) {
    auto opCall(Ts...)(Ts args) {
        return F(args);
    }
}

auto bar(T)(T a) @nogc nothrow @safe {
    auto f()
    {
        return a;
    }

    Forward!f val;
    return val;
}

--


More information about the Digitalmars-d-bugs mailing list