[Issue 23112] code passes @nogc, allocates anyway

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 5 03:24:09 UTC 2022


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

--- Comment #2 from Walter Bright <bugzilla at digitalmars.com> ---
(In reply to Dennis from comment #1)
>     auto call()() 

Rewriting as:

>     auto call()

and it gives the error:

test2.d(8): Error: function `test2.bar` is `@nogc` yet allocates closures with
the GC
test2.d(10):        test2.bar.f closes over variable a at test2.d(8)

which is what we expect. The trouble with the template version is the
semantic3() of bar() should run the semantic3() of Forward.call, which is
necessary to discover that bar() requires a closure. But it does not do the
semantic3() of Forward.call until after semantic3() for bar() has completed.

--


More information about the Digitalmars-d-bugs mailing list