This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Question - getting rid of a warning message


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.
begin:vcard 
n:Bouchard;Philippe
x-mozilla-html:FALSE
org:Corel Linux
adr:;;;;;;
version:2.1
email;internet:philippeb@corel.com
title:Software Engineer
x-mozilla-cpt:;0
fn:Philippe Bouchard
end:vcard

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]