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/40563] New: -Wc++-compat does not warn about uninitialized const field in struct


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


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