This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/44128] New: C++ frontend not warn on type shadowing with -Wshadow
- From: "lcwu at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 May 2010 23:03:23 -0000
- Subject: [Bug c++/44128] New: C++ frontend not warn on type shadowing with -Wshadow
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This bug is a follow-up to bug c++/44122.
Given the following program:
$ cat t.c
typedef long Py_ssize_t;
void bar() {
typedef int Py_ssize_t;
Py_ssize_t pos;
}
When compiled with the C compiler with -Wshadow flag, a shadow warning is
emitted.
$ gcc -c t.c -Wshadow
t.c: In function ?bar?:
t.c:5:14: warning: declaration of ?Py_ssize_t? shadows a global declaration
[-Wshadow]
t.c:1:14: warning: shadowed declaration is here [-Wshadow]
However, when using the C++ compiler with the same flag, no warning is emitted.
$ g++ -c t.c -Wshadow
I think C++ frontend should warn on this case as the C frontend.
--
Summary: C++ frontend not warn on type shadowing with -Wshadow
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: lcwu at gcc dot gnu dot org
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44128