This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Multiple inheritance bug (ICE 980715)
> What is `Koenig lookup'?
If you have a function call where the function name is unqualified,
e.g
foo(x,y,z);
the compiler computes 'candidate functions' for foo at some point, and
then uses 'overload resolution' to select one. The candidate functions
are not only those versions of foo that are visible - the compiler
shall also investigate whether x, y, or z have parameter types defined
in a namespace. Given
namespace MyStuff{
struct X{...};
foo(X, int, int);
}
MyStuff::X x;
the compiler will call MyStuff::foo, even though it is not visible
outside MyStuff.
Andrew Koenig came up with that idea, so the colloquial name of the
algorithm is 'Koenig lookup'. The formal name is "argument type
dependent lookup".
The algorithm is straight-forward as long as x,y,z have simple or
class types. If they have function types, things get tricky. The
compiler was confused to found that the argument could be both a
function and an integer. As I said, I believe this is illegal.
Regards,
Martin