Title
Footnote 116 and Koenig lookup
Status
cd1
Section
12.2.2.2.2 [over.call.func]
Submitter
Steve Clamage

Created on 2000-08-02.00:00:00 last changed 162 months ago

Messages

Date: 2001-04-15.00:00:00

[Moved to DR at 4/01 meeting.]

Date: 2001-04-15.00:00:00

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.

Date: 2004-09-10.00:00:00
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.)

History
Date User Action Args
2008-10-05 00:00:00adminsetstatus: wp -> cd1
2003-04-25 00:00:00adminsetstatus: dr -> wp
2002-05-10 00:00:00adminsetmessages: + msg687
2001-05-20 00:00:00adminsetstatus: ready -> dr
2000-11-18 00:00:00adminsetmessages: + msg401
2000-11-18 00:00:00adminsetstatus: open -> ready
2000-08-02 00:00:00admincreate