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

Paolo Carlini pcarlini@unitus.it
Tue Jul 2 15:35:00 GMT 2002


Nickolai Dobrynin wrote:

>I just think of it as being totally counter intuitive that the same nifty
>feature is not valid (is NO LONGER valid, would be a better way to say it)
>on non-constant initializers.
>
>So, would indeed this be possible to restore the behavior of 2.95.x or it
>would come in conflict with something else? Any opinions on that?
>
Nicolai, first thanks for your message from which I have learned much 
about the issue at hand. On the other hand, I think that Mark's answer 
stands: if the standard does /not/ prescribe a particular ordering this 
cannot be considered a bug and, moreover, yourself proved that there is 
a way (thanks, once more) to do this kind of tricks which does /not/ 
relies on not well-defined behavior. The latter two points imply that 
most probably the old behaviour will not be restored very soon ;-)

>PS  Is it a normal behavior that the option -ftemplate-depth-... is no
>longer needed in order for the example above to compile properly?
>
Yes. Currently the default max depth is 500:

2002-01-10  Jakub Jelinek  <jakub@redhat.com>

    * decl2.c (max_tinst_depth): Increase default limit to 500.

Ciao,
Paolo.




More information about the Gcc-bugs mailing list