Argument-dependent lookup and dependent function template parameter types
6.5.4 [basic.lookup.argdep]
James Widman

Created on 2009-11-06.00:00:00 last changed 96 months ago


Date: 2011-03-15.00:00:00

[Voted into the WP at the March, 2011 meeting as part of paper N3262.]

Date: 2010-11-15.00:00:00

Proposed resolution (November, 2010) [SUPERSEDED]:

Change 6.5.4 [basic.lookup.argdep] paragraph 2 as follows:

...In addition, if the argument is the name or address of a set of overloaded functions and/or function templates, its associated classes and namespaces are the union of those associated with each of the members of the set, i.e., the classes and namespaces associated with its (non-dependent) parameter types and return type. Additionally, if the aforementioned set of overloaded functions is named with a template-id, its associated classes and namespaces are those of its type template-arguments and its template template-arguments.

This resolution also resolves issue 1015.

[Drafting note: It's not clear that we need the inserted text above, because for the example in issue 1015, the type N::S is already represented in the type of the function address, so there is no need to pull it from template arguments. For cases where template parameters are not represented in the function type, it's not clear that we want ADL to reach further.]

Date: 2010-11-15.00:00:00

Notes from the November, 2010 meeting:

The CWG agreed that the rules should be changed to make this example well-formed.

Date: 2010-08-23.00:00:00

6.5.4 [basic.lookup.argdep] paragraph 2 excludes dependent parameter types and return types from consideration in determining the associated classes and namespaces of a function template. Presumably this means that an example like

    namespace N {
      template<class T> struct A { };
      void f(void (*)());

    template <class T>
    void g(T, N::A<T>);

    void g();

    int main() {

is ill-formed because the second parameter of the function template g does not add namespace N to the list of associated namespaces. This was probably unintentional.

See also issue 1015.

Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetmessages: + msg3293
2011-04-10 00:00:00adminsetstatus: review -> fdis
2010-11-29 00:00:00adminsetmessages: + msg3071
2010-11-29 00:00:00adminsetmessages: + msg3070
2010-11-29 00:00:00adminsetstatus: open -> review
2009-11-06 00:00:00admincreate