bug in compiles?
Steven Schveighoffer
schveiguy at gmail.com
Thu Apr 11 19:42:05 UTC 2019
On 4/11/19 2:13 PM, Alex wrote:
> The following code works when I comment out the static if
>
> //static if (__traits(compiles, __traits(getAttributes, T)))
> static foreach(a; __traits(getAttributes, T)) Attributes ~=
>
>
> There seems to be absolutely no reason why this code would fail with the
> static if but pass without it but in the first case I get no attributes
> because the __traits compiles fails.
>
>
>
> __traits(compiles, __traits(getAttributes, T))
>
> vs
>
> __traits(getAttributes, T)
>
> How could it not compile in the first case and yet work in the foreach?
It should. Do you have a larger example? One that can be played with?
-Steve
More information about the Digitalmars-d-learn
mailing list