Attempting to compile the following code with "g++ -Weffc++ -c test.cpp"

union value
{
    value( void ) : m_int(0) { }
    int m_int;
    float m_float;
};

yields warning: test.cpp:3: warning: ‘value::m_float’ should be initialized in
the member initialization list

This warning is incorrect as it is illegal for unions to initialize more than
one member.


-- 
           Summary: union warnings using -Weffc++ flag
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hayden dot james at gmail dot com
GCC target triplet: Target: x86_64-redhat-linux


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

Reply via email to