2.91.40: missing features in namespaces

Martin v. Loewis loewis@informatik.hu-berlin.de
Mon Jun 22 13:30:00 GMT 1998


> 1) namespace directives and declarations should
>    be allowed within a function body (s. [1] 8.2.2,
>   [1] 8.2.3) :

Right. This is missing, but I hope it will be in 1.1. (if I manage to
meet the deadline).

> 2) If we call a function `f' from namespace `ns' with
>    an argument `a' of type `T' declared in the same namespace, 
>   no namespace resolution should be necessary ([1] 8.2.6) :

Right. This is referred to as argument-type dependent lookup, or
Koenig lookup (as Andrew Koenig came up with it (?)).

At the moment, it works only for operator calls, not for plain
function calls. The problem is not to determine that ns::f(const
ns::T&) is a candidate if Koenig lookup is applied. The problem is to
determine that Koenig lookup needs to be applied at all.

For illustration, it is not applied in the following cases:

  X::f(a);
  o.f(a);
  o->f(a);
  (*f)(a);
  (++f)(a);

etc. So the tricky part is to find out whether the function is an
unqualified identifier at the time when all argument types are
determined. In current g++, you either know it's unqualified, or you
know all argument types.

Martin



More information about the Gcc-bugs mailing list