Cannot compile unittest with @nogc attribute

Issue #2 wontfix
Stefan Frijters created an issue

~/d/unstandard-upstream (master) > dub test --compiler=dmd Generating test runner configuration 'test__library' for 'library' (library).

Building unstandard ~master configuration "test__library", build type unittest.

Compiling using dmd...

unstd/c/string.d(240): Error: @nogc function 'unstd.c.string.__unittestL233_11' cannot call non-@nogc function 'unstd.c.string.toCString!(malloc, char, char).toCString'

FAIL .dub/build/test__library-unittest-linux.posix-x86_64-dmd_2066-4E2D7AC88264C35BAE9EA64B0BEE0263/ test__library executable

Error executing command test:

dmd failed with exit code 1.

Occurs with dmd 2.066.1 / ldc 0.15.1 / gdc master.

This seems to resolved by removing the @nogc from the unittest.

Comments (4)

  1. Denis Shelomovskii repo owner

    toCString!malloc is a @nogc function and tests passes with 'HEAD' dmd/druntime/Phobos commits (except CTFE pointers bug is fixed so a workaround in unstd.array asks to remove itself (I'll do it after compiler release)).

    Will test "2.066.1" soon.

  2. Denis Shelomovskii repo owner

    OK, onOutOfMemoryError, onRangeError and other functions aren't marked @nogc in that release. Use Git HEAD if you want to build unittests.

  3. Log in to comment