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

Reply via email to