This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-09-28


239. Footnote 116 and Koenig lookup

Section: 12.2.2.2.2  [over.call.func]     Status: CD1     Submitter: Steve Clamage     Date: 2 Aug 2000

[Moved to DR at 4/01 meeting.]

In describing non-member functions in an overload set, footnote 116 (12.2.2.2.2 [over.call.func]) says,
Because of the usual name hiding rules, these will be introduced by declarations or by using-directives all found in the same block or all found at namespace scope.

At least in terms of the current state of the Standard, this is not correct: a block extern declaration does not prevent Koenig lookup from occurring. For example,

 enum E { zero }; void f(E); void g() { void f(int); f(zero); } 

In this example, the overload set will include declarations from both namespace and block scope.

(See also issue 12.)

Proposed resolution (04/01):

  1. In 6.5.4 [basic.lookup.argdep] paragraph 2, change

    If the ordinary unqualified lookup of the name finds the declaration of a class member function, the associated namespaces and classes are not considered.

    to

    If the ordinary unqualified lookup of the name finds the declaration of a class member function, or a block-scope function declaration that is not a using-declaration, the associated namespaces and classes are not considered.

    and change the example to:

     namespace NS { class T { }; void f(T); void g(T, int); } NS::T parm; void g(NS::T, float); int main() { f(parm); // OK: calls NS::f extern void g(NS::T, float); g(parm, 1); // OK: calls g(NS::T, float) } 
  2. In 12.2.2.2.2 [over.call.func] paragraph 3 from:

    If the name resolves to a non-member function declaration, that function and its overloaded declarations constitute the set of candidate functions.

    to

    If the name resolves to a set of non-member function declarations, that set of functions constitutes the set of candidate functions.

    Note that this text is also edited by issue 364. Also, remove the associated footnote 116.