__traits(compiles) + mixin

Timon Gehr timon.gehr at gmx.ch
Tue Mar 5 04:58:57 PST 2013


On 03/05/2013 08:53 AM, cal wrote:
> I'm confused about this:
>
> import std.conv;
>
> void main()
> {
>      enum s = "`1`.to!int;";
>      enum c = __traits(compiles, mixin("{auto a = new "~s~";}")); // line 1
>      mixin("auto a = "~s~";"); // line 2
> }
>
> This does not compile, giving errors about instantiating
> std.conv.to!(int).to!(string). If I switch the order of lines 1 and 2 it
> compiles. Is this a bug or something I don't understand about
> __traits(compiles)?

Compiles as expected with DMD 2.060. It is probably a regression.


More information about the Digitalmars-d-learn mailing list