__traits(compiles, ...) returns true for syntactic garbage and for semantically incorrect code

David Nadlinger see at klickverbot.at
Mon Dec 17 06:18:24 PST 2012


On Monday, 17 December 2012 at 14:15:42 UTC, Pavel wrote:
> It seems to me handier to use it from templates manipulating 
> code as strings than usage of __traits(compiles,...) directly.

I'm not quite sure how this is nicer to use than »enum foo = 
__traits(compiles, { mixin(bar); });«, but tastes differ…

David


More information about the Digitalmars-d mailing list