February 17, 2019 [Issue 19682] Unused alias causes @nogc error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19682 --- Comment #1 from andy.pj.hanson@gmail.com --- This error is happening for used callbacks too. ```d import core.stdc.stdio : printf; void callThese(cbs...)() { static foreach (i; 0..cbs.length) cbs[i](); } @nogc: void main() { int x = 0; callThese!( () { int y = x; printf("a\n"); }, () { printf("b\n"); }, )(); } ``` Removing the `@nogc` and running shows that both are called, but there is still a compile error with `@nogc`: ``` source/app.d(10,6): Error: function `D main` is @nogc yet allocates closures with the GC source/app.d(13,3): app.main.__lambda1 closes over variable x at source/app.d(11,6) ``` (had to put `callThese` above the `@nogc:` because of https://issues.dlang.org/show_bug.cgi?id=17800 ) -- |
December 17, 2022 [Issue 19682] Unused alias causes @nogc error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19682 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
Copyright © 1999-2021 by the D Language Foundation