I would like to debug a few things and need to insert print statements to figure things out. I thought that using debug print would be ok in nogc code?

Seems it make the compiler infer f as not nogc though so this is basically unworkable unless I go through my entire source code and remove the @nogc attribute wherever function f is used.

Anyway around this?

Here's example code:

import std.stdio;

void f(T)(auto ref T) {
    debug writeln("yo");
}

@nogc void main() {
        f(3);
}

Error: @nogc function D main cannot call non-@nogc function onlineapp.f!int.f

Cheers,
- Ali

Reply via email to