This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [RFA] cpplib/C/C++: Unify character constant interpretation


John Marshall wrote:-

> >        /* In C, a character constant has type 'int'; in C++, 'char'.  */
> > -      if (chars_seen <= 1 && c_language == clk_cplusplus)
> > +      if (c_language == clk_cplusplus)
> >         TREE_TYPE (value) = char_type_node;
> >        else
> >         TREE_TYPE (value) = integer_type_node;
> 
> This is incorrect.  Whatever their values might happen to be, C++ char
> literals containing more than one char have type int (section 2.13.2).

Thanks - I don't have a C++ standard; I guess I should buy one:-)

I'll revert this; the main reason I changed this was that the "chars_seen"
variable no longer exists (in this routine, at least) and I didn't think
anyone used it, but clearly they do.

Neil.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]