Question - getting rid of a warning message

Philippe Bouchard philippeb@corel.com
Fri Oct 20 08:49:00 GMT 2000


Hi,

How do I get rid of this warning message (without modifying the -W
flags):
cparser.h:331: warning: choosing `CAtomic<long int>::operator long int
&()' over `CAtomic<long int>::operator const long int &() const'
cparser.h:331: warning:   for conversion from `CAtomic<long int>' to
`long int'
cparser.h:331: warning:   because conversion sequence for the argument
is better

The class CAtomic<long int> contains 2 cast operators:
operator long int & ();
operator long int const & () const;

Line 329 of cparser.h looks like this:
template <typename T, typename I> inline CParser::Data &
CParser::Field<T, I>::operator >> (CParser & i)
{
  (*i.yyout) << static_cast<T &>(*this);
  return *this;
}

The warning is not necessary because *this is NOT constant and should be
used anyway (since the appropriate function is there).

Thanks again.


More information about the Gcc-bugs mailing list