This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Question - getting rid of a warning message
- To: gcc-bugs <gcc-bugs at gcc dot gnu dot org>
- Subject: Question - getting rid of a warning message
- From: Philippe Bouchard <philippeb at corel dot com>
- Date: Fri, 20 Oct 2000 11:53:48 +0000
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