This is the mail archive of the gcc-help@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]
Other format: [Raw text]

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.


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