Stripping away const/invariant in D 2.0

Christian Kamm kamm.incasoftware at shift-at-left-and-remove-this.de
Tue Aug 28 04:59:40 PDT 2007


>> However, I think templates are broken with regard to const, since:
>> 
>> class T {}
>> const(T) var;
>> pragma(msg, typeof(var));
>> errors with
>> consttest.d(14): Error: string expected for message, not 'const T'
>> 
>> and
>> 
>> template Foo(Q) {
>>   pragma(msg, Q);
>> }
>> 
>> class T {}
>> const(T) var;
>> Foo!(typeof(var));
>> errors with
>> consttest.d(7): pragma msg string expected for message, not 'T'
>> 
> 
> Shouldn't those be typeof(var).stringof and Q.stringof?

Yes, I simply forgot about the existence of strongof for a moment. With that
change you'd get "const T" instead of the first and "T" instead of the
second error message. 

Christian



More information about the Digitalmars-d mailing list