https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103728
--- Comment #1 from Iain Buclaw <ibuclaw at gdcproject dot org> --- Not sure if there'd be much help from the compiler on this front, as it's a runtime library feature that unittests are executed in the first place - the compiler simply generates functions in the proper place for the library to find them. See https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libphobos/libdruntime/rt/dmain2.d;h=b363e3fea4fc55d9f6941030dc808e5129bd38c2;hb=HEAD#l491 The old behaviour was of `runAll()` was: if (rt_init() && runModuleUnitTests()) tryExec({ result = mainFunc(args); }); > someone suggested to use this: > version (unittest) extern(C) __gshared string[] rt_options = [ "testmode=run- > main" ]; > It works well with gdc-12, but it is very cryptic and still hard to add in all > our binaries (we have dozens). A second way of doing the would be to run the program with the command-line option: --DRT-testmode=run-main The options itself gets filtered from the `string[] args` parameter of D main, so it won't affect tests where arguments are given to binaries (unless the --DRT option appears after `--`).