Module-level attributes and unit tests

Leandro Motta Barros via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 23 08:25:37 PDT 2014


Hello,

I have a module which is completelly @nogc, and as such I'd like to just say

   @nogc:

at the top of the file and be happy.

However, my unit tests for this same module do some GC allocation, so the
module fails to compile.

Is there a way to disable @nogc for the unit tests only? Would this be a
bad idea in some way I cannot see?

I suppose the same question is valid for other attributes, like 'nothrow'
and '@safe'.

Thank you,

LMB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20140823/2496ea0d/attachment.html>


More information about the Digitalmars-d-learn mailing list