__traits(compiles) + mixin

Andrej Mitrovic andrej.mitrovich at gmail.com
Tue Mar 5 00:17:35 PST 2013


On 3/5/13, cal <callumenator at gmail.com> wrote:
> So why does this work:
>
> import std.conv;
>
> void main()
> {
>      enum s = "`1`.to!int;";
>      enum c = __traits(compiles, mixin("{auto x = "~s~";}")); //
> true
> }

That's a function literal, i.e. an expression.


More information about the Digitalmars-d-learn mailing list