hasDataMember and mixin inconsistency
Philippe Sigaud
philippe.sigaud at gmail.com
Sun Jan 27 08:50:38 PST 2013
>> string hasDataMember( T )(string M )
>> {
>> return " __traits(compiles, {
>> Test t;
>> auto _ = t.D; // reading t.M
>> t." ~ M ~ " = t." ~ M ~ "; // assign to t.M
>> })";
>> }
>
>
> What is the purpose of "auto _ = t.D;" ?
Just testing whether t.M can be assigned to something (ie, is it a value?)
I use '_' as a variable name to indicate I don't care for it's precise
name/value. It's just a placeholder.
> Using dmd 2.060 and command line "rdmd test.d", I get an assertion fail on
> both calls that check for a member "init" whether for int or Test.
Using 2.061 here.
More information about the Digitalmars-d-learn
mailing list