This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/55671] New: -Wconversion fails to warn for sign-conversion
- From: "loose at astron dot nl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 13 Dec 2012 08:45:40 +0000
- Subject: [Bug c++/55671] New: -Wconversion fails to warn for sign-conversion
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55671
Bug #: 55671
Summary: -Wconversion fails to warn for sign-conversion
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: loose@astron.nl
g++ doesn't warn about the following statement when using -Wconversion, whereas
gcc does.
$ cat Wconversion-bug.c
unsigned i = -1;
$ g++ -Wconversion -c Wconversion-bug.c
[no output]
$ gcc -Wconversion -c Wconversion-bug.c
Wconversion-bug.c:1:1: warning: negative integer implicitly converted to
unsigned type [-Wsign-conversion]
$ g++ --version
g++ (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.