Incorrect overload choice
Dave Williss
dwilliss@microimages.com
Mon May 20 09:47:00 GMT 2002
One of our programmers reported a compile error that he's getting that seems
wrong. I've asked him to create a simple example that I can post, but here's
the basic
gist of the problem.
miehdf.c:516: warning: choosing `HDF4_NAME::operator char *()' over
`FIXEDSTRCHAR<256>::operator const char *() const'
miehdf.c:516: warning: for conversion from `HDF4_NAME' to `const char *'
miehdf.c:516: warning: because conversion sequence for the argument is
better
/usr/local/include/mi32/hdf4.h:66: `HDF4_NAME::operator char *()' is private
miehdf.c:516: within this context
I don't know how these two classes are related, but the basic problem is
that, faced
with a choice of overloads for cast to char*, it's warning that it's taking
the non-const
one instead of the const that was requested because the conversion sequence
is
"better", but then gives an error because the non-const operator is private.
He says that 2.95.2 gave the warning s about the conversion sequence, but
the error
started when we upgraded to 3.0.4.
Like I said, he's going to try to produce a small sample for me to post
here.
-- Dave Williss
------
Meddle not in the affairs of dragons,
for you are crunchy and taste good with catsup
More information about the Gcc-bugs
mailing list