public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19968] New: Warning omitted for non-derived classes
@ 2005-02-15 13:29 reichelt at gcc dot gnu dot org
  2005-02-15 14:14 ` [Bug c++/19968] [3.3/3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-02-15 13:29 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-03-02 21:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-15 13:29 [Bug c++/19968] New: Warning omitted for non-derived classes reichelt at gcc dot gnu dot org
2005-02-15 14:14 ` [Bug c++/19968] [3.3/3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
2005-02-15 14:14 ` [Bug c++/19968] " reichelt at gcc dot gnu dot org
2005-03-02 21:36 ` [Bug c++/19968] [3.3/3.4/4.0/4.1 Regression] " aoliva at gcc dot gnu dot org
2005-03-02 21:54 ` bangerth at dealii dot org

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).