On Sunday, 13 July 2014 at 15:34:31 UTC, Dicebot wrote:
std.typecons.scoped _should_ still work - I actually suggest adding unit tests for this as it is quite an important use case.


std.typecons.scoped works per se (I'm adding unittests as we speak) but using my current dmd, this:

    // confirm scoped allocation is @nogc
    void scopedRNG(T)(T seed) @nogc
    {
        auto gen = scoped!UniformRNG(seed);
    }

    scopedRNG(unpredictableSeed);

... fails to compile with the error,

Error: @nogc function 'hap.random.generator.__unittestL91_27.scopedRNG!uint.scopedRNG' cannot call non-@nogc function 'std.typecons.scoped!(LinearCongruentialEngine!(uint, 16807u, 0u, 2147483647u)).scoped!(uint).scoped'

... even if the constructor of the RNG in question is marked @nogc together with all that it calls.

Is this possibly an issue with 'scoped'? Was it only quite recently patched to support @nogc? I'll update my installed compiler if so.

Reply via email to