Bug? tupleof and const string = ""

Andre andre at s-e-a-p.de
Thu Feb 13 08:58:14 PST 2014


Am 13.02.2014 17:52, schrieb bearophile:
> Andre:
>
>> could you have a look whether this is a bug with tupleof?
>> In case you have a const string with a default value,
>> the attribute is not in the tupleof list.
>>
>> struct A {
>>     const string a = "abc";
>>     string d;
>> }
>>
>> void main(){
>>     assert(A().tupleof.length == 2); // fails -> length = 1
>> }
>
> Tupleeof is working correctly here. Currently const/immutable fields
> don't become struct instance fields. After a transition phase this will
> be changed, and in some months you will see two fields there. DMD 2.065
> has a warning on this.
>
> Bye,
> bearophile


Thanks for the info. Time to update to 2.065:)

Kind regards
André


More information about the Digitalmars-d-learn mailing list