public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/4301: gcc 3.0.1 thinks wchar_t is a signed type when it's not
@ 2001-09-11 8:36 sebor
0 siblings, 0 replies; 3+ messages in thread
From: sebor @ 2001-09-11 8:36 UTC (permalink / raw)
To: gcc-gnats
>Number: 4301
>Category: c++
>Synopsis: gcc 3.0.1 thinks wchar_t is a signed type when it's not
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Sep 11 08:36:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: sebor@roguewave.com
>Release: 3.0.1
>Organization:
>Environment:
>Description:
The compiler complains about comparisons between wchar_t and
values of unsigned types. The C++ library's numeric_limits
claims that wchar_t is a signed type. However, values of
wchar_t clearly behave as unsigned. The behavior is the
same in 2.95.2 (except for the C++ library part).
Regards
Martin
>How-To-Repeat:
$ cat t.cpp ; gcc -Wall t.cpp && ./a.out
#include <limits>
#include <cstdio>
int main ()
{
unsigned a = 0;
wchar_t b = -1;
std::printf ("std::numeric_limits<unsigned>::is_signed = %d\n",
std::numeric_limits<unsigned>::is_signed);
std::printf ("std::numeric_limits<wchar_t>::is_signed = %d\n",
std::numeric_limits<wchar_t>::is_signed);
std::printf ("wchar_t (-1) < 0 = %d\n", b < a);
}
t.cpp: In function `int main()':
t.cpp:15: warning: comparison between signed and unsigned integer expressions
std::numeric_limits<unsigned>::is_signed = 0
std::numeric_limits<wchar_t>::is_signed = 1
wchar_t (-1) < 0 = 0
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c++/4301: gcc 3.0.1 thinks wchar_t is a signed type when it's not
@ 2001-09-14 6:50 lerdsuwa
0 siblings, 0 replies; 3+ messages in thread
From: lerdsuwa @ 2001-09-14 6:50 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, sebor
Synopsis: gcc 3.0.1 thinks wchar_t is a signed type when it's not
State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Fri Sep 14 06:50:51 2001
State-Changed-Why:
Closed by the request of submitter.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4301&database=gcc
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c++/4301: gcc 3.0.1 thinks wchar_t is a signed type when it's not
@ 2001-09-12 8:56 Martin Sebor
0 siblings, 0 replies; 3+ messages in thread
From: Martin Sebor @ 2001-09-12 8:56 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/4301; it has been noted by GNATS.
From: Martin Sebor <sebor@roguewave.com>
To: gcc-gnats@gcc.gnu.org
Cc:
Subject: Re: c++/4301: gcc 3.0.1 thinks wchar_t is a signed type when it's not
Date: Wed, 12 Sep 2001 09:52:23 -0600
sebor@roguewave.com wrote:
>
> >Number: 4301
> >Category: c++
> >Synopsis: gcc 3.0.1 thinks wchar_t is a signed type when it's not
...
> >Description:
> The compiler complains about comparisons between wchar_t and
> values of unsigned types. The C++ library's numeric_limits
> claims that wchar_t is a signed type. However, values of
> wchar_t clearly behave as unsigned. The behavior is the
> same in 2.95.2 (except for the C++ library part).
Oops, sorry about this. wchar_t apparently is signed on the platforms
I tried and the test case is wrong (I missed the promotion from wchar_t
to unsigned in the b < a expression). I withdraw the bug report.
Thanks
Martin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-09-14 6:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-11 8:36 c++/4301: gcc 3.0.1 thinks wchar_t is a signed type when it's not sebor
2001-09-12 8:56 Martin Sebor
2001-09-14 6:50 lerdsuwa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).