Re: Default constructor error
On 5/19/2011 1:14 PM, Ruben Safir wrote:
I'm getting this warning that appears in the 4.6 GCC compiler that didn't
happen before.
the warning is
/home/ruben/cplus/link_list_template_mysql/stats.h|45 col 42| warning:
converting to non-pointer type ???int??? from NULL [-Wconversion-null]
if comes from a default constructor
Distribution():freq(NULL), occurances(0){};
occurances is an int type, and the compiler is complaining about
occurances(0)
it goes away when I change it to
Distribution():freq(NULL){
occurances = 0;
};
but then it complains about freq which is of type T in a template
Given some extrapolation in lieu of the information you didn't provide
(like the definition of the 'Distribution' class), it seems that the
compiler is just buggy. Have you tried a different version of the same
compiler, with the same -Wconversion-null option?
Take your code to the Comeau online compiler interface
(http://www.comeaucomputing.com/tryitout) and see if it compiles it
cleanly. Then, if the code is OK, file a bug report against GCC.
V
--
I do not respond to top-posted replies, please don't ask