December 01, 2006
Sean Kelly wrote:
> Bill Baxter wrote:
>> Bummer, that doesn't seem to work inside a class member template:
>>
>> class Foo {
>>     template myCast(T) {
>>         T myCast(U)(U val) {
>>             return cast(T) val;
>>         }
>>     }
>> }
>>
>> void main() {
>>   Foo foo = new Foo;
>>   int i = foo.myCast!(int)(1.0);
>> }
>>
>> -->
>> Error: function expected before (), not 'foo dotexp template myCast(U)'
> 
> Hopefully, this is just a bug.  If it can be made to work I don't see a pressing need for partial template argument evaluation.

Attached is a small and ugly patch that should resolve this. I don't have a proper regression testing framework running, so it is quite the opposite of extensively tested and should be written much more properly. It just serves to illustrate that this is definitely fixable.

/Oskar


1 2 3 4
Next ›   Last »