compile time output

Trass3r mrmocool at gmx.de
Tue Jan 20 13:02:25 PST 2009


Sergey Gromov schrieb:
  > class Cls
> {
>   int bar;
>   char[] baz;
> }
> string foo()
> {
>   auto members = __traits(allMembers, Cls);
>   return "";
> }
> pragma(msg, foo());
> 
>> dmd -c test.d
> test.d(11): Error: cannot evaluate foo() at compile time
> test.d(11): pragma msg string expected for message, not 'foo()'
> 
> Comment out the traits and it compiles.  Traits are supposed to be
> compile-time.  How's that possible for them to prevent compile-time
> evaluation?

Seeing this really simple example crashing makes me think that this has 
to be a bug.


More information about the Digitalmars-d-learn mailing list