This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/19968] New: Warning omitted for non-derived classes


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]