Rich Johnson <rjohnson@xxxxxxxxxxxxxxxxxxxxxxx> writes: | On Jan 19, 2006, at 4:46 AM, Dima Sorkin wrote: | | > On 18 Jan 2006 21:22:11 -0600, Gabriel Dos Reis wrote: | >> The program is indeed in error. There are two kinds of ambiguity: | >> (1) name lookup ambiguity | >> (2) call ambiguity. | >> | >> Since overload resolution takes place only after name lookup, you | >> can't expect overload resolution to pick C1::f, when you're | >> already in | >> trouble with (1). | > | > I can add that you can read further about it in | > B. Stroustrup "The C++ Programming Language". | > Exactly this case is explained there. | > | | Thanks folks. I'll look again--specifically for "name ambiguity" | this time. (I have the 3rd edition) | | I think that what you're telling me is that the name resolution | algorithm uses _only_ the method's name (not its signature) to first | select a namespace, Not a namespace, but a base class. | and that since an "f(...)" exists in both "M::C1" | and "M::C2", the compiler is unable to select between them. | Furthermore this is the algorithm as defined by the language. | | What strikes me as odd is that both resolutions phases appear to rely | on only partial information. Name resolution doesn't appear to | consider signatures and overload resolution doesn't appear to | consider fully qualified names. If you fully qualify the name, either as C1::f or C2::f, then you'll resolve the ambiguity. -- Gaby