[Bug c++/43064] New: Include member name in C++ warning

jg at jguk dot org gcc-bugzilla@gcc.gnu.org
Sun Feb 14 18:40:00 GMT 2010


I noticed the C++ warnings in the following example have incorrect line
numbers, and the member name is missing. Is it possible to improve the warning
output?



$ g++ -Wconversion -o t main.cpp
main.cpp: In constructor ‘A::A()’:
main.cpp:18: warning: converting to non-pointer type ‘int’ from NULL
main.cpp:18: warning: converting to non-pointer type ‘unsigned int’ from NULL


I think the output should be like:

main.cpp:15: In constructor ‘A::A()’:
main.cpp:18: warning: converting to m_int non-pointer type ‘int’ from NULL
main.cpp:18: warning: converting to m_unit non-pointer type ‘unsigned int’ from
NULL


sample:
======================
// g++ -Wconversion -o t main.cpp

// include to get definition of NULL
#include <string.h>

class A
{
        public:
        A();
        bool m_bool;
        int m_int;
        unsigned int m_uint;
};

A::A()
: m_bool(NULL),
m_int(NULL),
m_uint(NULL)
{
}

int main()
{       
}
================================


-- 
           Summary: Include member name in C++ warning
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jg at jguk dot org


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



More information about the Gcc-bugs mailing list