__traits getMember is context sensetive?

John Colvin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 14 04:11:26 PDT 2015


On Sunday, 14 June 2015 at 10:16:24 UTC, JDemler wrote:
> On Sunday, 14 June 2015 at 10:04:35 UTC, John Colvin wrote:
>> [...]
>
> If that is the case then i really do not get why my first 
> example compiles and my second does not.
>
> The compiler sees the pragma(msg, test(e)) and runs test(e).
> If test uses __traits it does not work if it does not it works.
>
> If __traits is just another ctfe function i dont see the 
> difference.

An easy to remember rule: If it won't work at runtime, it won't 
work in ctfe.


More information about the Digitalmars-d-learn mailing list