compile time output
Sergey Gromov
snake.scaly at gmail.com
Tue Jan 20 13:31:22 PST 2009
Tue, 20 Jan 2009 21:12:18 +0000 (UTC), BCS wrote:
> Reply to Trass3r,
>
>> Sergey Gromov schrieb:
>>
>>> auto members = __traits(allMembers, Cls);
>>
>> Seeing this really simple example crashing makes me think that this
>> has to be a bug.
>>
>
> that auto might be mucking it up (if so it would be a bug).
Bingo. Replacing it with
string[] members = __traits(allMembers, Cls);
makes it compile. Therefore
class Cls
{
int bar;
char[] baz;
}
string foo()
{
string[] members = __traits(allMembers, Cls);
string result;
foreach(m; members)
result ~= m ~ " ";
return result;
}
pragma(msg, foo());
works.
More information about the Digitalmars-d-learn
mailing list