[Bug c++/11919] int vs. typedef int bar/signedness of chars
hans dot utz at informatik dot uni-ulm dot de
gcc-bugzilla@gcc.gnu.org
Thu Aug 14 15:01:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11919
------- Additional Comments From hans dot utz at informatik dot uni-ulm dot de 2003-08-14 15:01 -------
Subject: Re: int vs. typedef int bar/signedness of chars
bangerth at dealii dot org wrote:
>
> The reason, BTW, is that "char" is really "unsigned char", so either
> call to foo requires a conversion of the argument, either to "signed
> char" or to "int". If c is declared as "signed char", no error happens.
Really? I thought char, signed char and unsigned char are three different types
in C++ (in contrast to int and signed). Adding an overloaded function
void foo(unsigned char) {};
to the test case doesn't help. Also g++ 2.95.3/3.2/3.4 will still resolve
foo(c) to foo(int). I checked by adding distinct output to the function bodies.
On the other hand, a similar test case can be built with short vs. unsingned
short vs. int. So it seems that a "typedef int T" isn't considered for default
type conversions. (Explicit conversion helps.)
Hans
More information about the Gcc-bugs
mailing list