Trying to understand the actual text in the standard (§10.2) isn't easy,
but there is an example which makes it clear: name lookup for a name x
in the derived class fails if the name isn't present in the derived
class, but it is present in more than one base class, and it isn't
hidden. (Hidden isn't relevant here, as it only intervenes when virtual
inheritance is present.) As far as I can tell, this is the case
regardless of the name of the member; I can find no exception if the
member happens to have the special name operator()
. Overload
resolution doesn't come into play, because their is failure in the name
lookup, before the overload set is completely built. I'm pretty sure
that both snippets of code are illegal, and that there is a bug in
clang.
You can use using
declarations to inject the names into the derived
class, or you can explicitly define forwarding operators in the derived
class. Once the name is found in the derived class, the compiler stops,
and does not look in the base classes.