__traits(compiles) + mixin

cal callumenator at gmail.com
Tue Mar 5 00:20:22 PST 2013


On Tuesday, 5 March 2013 at 08:14:58 UTC, simendsjo wrote:
> Hmm.. And this also works:
> enum c = __traits(compiles, mixin("{auto a = new 1;}"));
>
> Something to do with CTFE combined with mixins?

But it gets this right, in that c is false. I had thought that by 
wrapping the declaration in braces, making it a function, that 
got around the 'no declarations' limitation.



More information about the Digitalmars-d-learn mailing list