c++/7181: foo<n>::bar = foo<n-1>::bar + foo<n-2>::bar evaluates to zero at compile time

Paolo Carlini pcarlini@unitus.it
Mon Jul 1 14:59:00 GMT 2002


Nathan Sidwell wrote:

>paolo@gcc.gnu.org wrote:
>  
>
>>Synopsis: foo<n>::bar = foo<n-1>::bar + foo<n-2>::bar evaluates to zero at
>>    
>>
>FYI, this is broken in 2.96RH too, so is quite old. The static initializers
>are emitted in the wrong order so we initialize foo<n> before foo<n-1>. doh!
>  
>
Thanks for your feedback.
You agree, I suppose, that is quite embarassing that g++ is no longer 
able to correctly compile the textbook example of template 
metaprogramming :-(

Paolo.




More information about the Gcc-bugs mailing list