------- Comment #3 from manu at gcc dot gnu dot org 2008-08-23 18:06 ------- In C:
/* Wrapper around c_common_type that is used by c-common.c and other front end optimizations that remove promotions. ENUMERAL_TYPEs are allowed here and are converted to their compatible integer types. BOOLEAN_TYPEs are allowed here and return either boolean_type_node or preferably a non-Boolean type as the common type. */ tree common_type (tree t1, tree t2) In C++: /* Return the common type of two types. We assume that comptypes has already been done and returned 1; if that isn't so, this may crash. This is the type for the result of most arithmetic operations if the operands have the given two types. */ tree common_type (tree t1, tree t2) They are not the same. C++ performs integral promotion, C doesn't. Which is a waste of time in C++ because everywhere common_type is called, integral promotions have been performed already. Duplicationg type_after_usual_arithmetic_conversions with a variant that does not perform promotions fixes the problem. But there should be a more elegant way to handle this than just duplicating the whole function... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37004