Multiple inheritance bug (ICE 980715)
Martin von Loewis
martin@mira.isdn.cs.tu-berlin.de
Sun Aug 30 23:35:00 GMT 1998
> 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
More information about the Gcc-bugs
mailing list