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: nob...@puremagic.com
          Reporter: su+dlangiss...@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;
}

--

Reply via email to