[Bug c++/55837] New: -Weffc++: warning: 'xxx:yyy' should be initialized in the member initialization list

hamren at sdu dot se gcc-bugzilla@gcc.gnu.org
Mon Dec 31 23:41:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55837

             Bug #: 55837
           Summary: -Weffc++: warning: 'xxx:yyy' should be initialized in
                    the member initialization list
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hamren@sdu.se


Created attachment 29067
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29067
Self-contained source file

This code

    static struct Error {
        int child_pid = 0;
        struct {
            bool s_sensor = false;
        } opt;
    } ss;

gives a warning message

    'Error::opt' should be initialized in the member initialization list
[-Weffc++]

But Error::opt is already initialized, since its only member is initialized.

/Lars Hamrén



More information about the Gcc-bugs mailing list