This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: operator[] ambiguous
Michael Gong <gongweigang@gmail.com> writes:
> If I compile with g++, it has following error message:
>
> ISO C++ says that `char& A::operator[](unsigned int)' and
> `operator[]' are ambiguous even though the worst conversion for the
> former is better than the worst conversion for the latter
What version of g++ are you using?
I tried compiling your example with every version of g++ I have on this
system (4.3.5, 4.4.4, 4.5.1, and 4.6/trunk), and none gave an error (and
looking at the result, all seem to be using the A::operator[] method).
-Miles
--
Joy, n. An emotion variously excited, but in its highest degree arising from
the contemplation of grief in another.