This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/40563] New: -Wc++-compat does not warn about uninitialized const field in struct
- From: "ian at airs dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Jun 2009 21:04:55 -0000
- Subject: [Bug c/40563] New: -Wc++-compat does not warn about uninitialized const field in struct
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This program
struct s { const int i; };
int foo () { struct s v; }
is invalid C++:
foo.c: In function ?int foo()?:
foo.c:2: error: structure ?v? with uninitialized const members
However, no warning is issued when compiling the program as C using
-Wc++-compat. -Wc++-compat should issue a warning for this case, along the
lines of the warning for an initialized const variable.
--
Summary: -Wc++-compat does not warn about uninitialized const
field in struct
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ian at airs dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40563