Movatterモバイル変換


[0]ホーム

URL:


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

2025-12-20


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, footnote116 (12.2.2.2.2 [over.call.func]) says,
Because of the usual name hiding rules, these will be introduced bydeclarations or byusing-directives all found in the same blockor all found at namespace scope.

At least in terms of the current state of the Standard, thisis not correct: a block extern declaration does not preventKoenig 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 declarationsfrom both namespace and block scope.

(See alsoissue 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 declarationof a class member function, the associated namespaces and classes arenot considered.

    to

    If the ordinary unqualified lookup of the name finds the declarationof a class member function, or a block-scope function declarationthat is not ausing-declaration, the associated namespacesand 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, thatfunction and its overloaded declarations constitute the set ofcandidate 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 byissue 364.Also, remove the associated footnote 116.




[8]ページ先頭

©2009-2026 Movatter.jp