------- Comment #6 from pinskia at gcc dot gnu dot org 2006-09-02 01:36 ------- (In reply to comment #5) > 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".
-- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28886