More bugs...

SomeDude lovelydear at mailmetrash.com
Sat Apr 28 03:03:02 PDT 2012


On Saturday, 28 April 2012 at 09:36:55 UTC, Timon Gehr wrote:
> On 04/28/2012 08:03 AM, Mehrdad wrote:
>>> You expected that to work?
>>
>> Uhm, why not?
>>
>> template<class T>
>> struct F
>> {
>>    F<F<T> > f() { return F<F<T> >(); }
>> };
>>
>> int main()
>> {
>>    F<int>().f().f().f().f().f();  // etc.
>>    return 0;
>> }
>
>
> D templates are analysed eagerly upon instantiation, whereas 
> C++ templates are analysed lazily. This is not a bug, it is a 
> feature.

Having browsed several hundreds bug reports lately, I've seen a 
number of reports complaining that recursive templates 
instantiation failed. I've resisted the urge to comment that they 
were invalid. Although I do think they are invalid.


More information about the Digitalmars-d mailing list