This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/19968] New: Warning omitted for non-derived classes
- From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Feb 2005 01:26:41 -0000
- Subject: [Bug c++/19968] New: Warning omitted for non-derived classes
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Compiling the following code snippet with -Wextra, a sensible warning
is issued:
======================
struct B {};
struct A : B
{
const int i;
};
======================
warn.cc:5: warning: non-static const member 'const int A::i' in class without a
constructor
However, if A is not a derived class, the warning is not given:
======================
struct A
{
const int i;
};
======================
This is at least inconsistent. I'd vote for a warning in the second case, too.
--
Summary: Warning omitted for non-derived classes
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Keywords: diagnostic, monitored
Severity: enhancement
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: reichelt at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19968