On Fri, 2006-09-01 at 22:30 +0000, mark at codesourcery dot com wrote: > So, that's what should be fixed. Except that means introducing a language hook which is only to be useful in one place.
The other way of fixing this is not to call fold if we have a MINUS_EXPR with the 2nd operand as 1, we just use the first. Really I don't see any reason why we should introduce a language hook when we can just strip the NON_LVALUE_EXPR right after fold and introducing a language hook which will only help in one specific case. The real real way of fixing this is to move the C++ front-end's templates from using trees and use something which is just specific to the C++ front-end and we would not have to call fold here at all since we will just store the length of the array instead of the "length-1". -- Pinski