Title
Issues with two-stage lookup of dependent names
Status
cd1
Section
13.8.4.2 [temp.dep.candidate]
Submitter
Derek Inglis

Created on 2000-01-26.00:00:00 last changed 161 months ago

Messages

Date: 2005-10-15.00:00:00

[Voted into WP at October 2005 meeting.]

Date: 2005-04-15.00:00:00

Proposed resolution (April, 2005):

Change the example in 13.8 [temp.res] paragraph 9 as follows:

    void f(char);

    template <class T> void g(T t)
    {
        f(1);        // f(char);
        f(T(1));     // dependent
        f(t);        // dependent
        dd++;        // not dependent
                     // error: declaration for dd not found
    }

    enum E { e };
    void f(intE);

    double dd;
    void h()
    {
        g(2e);       // will cause one call of f(char) followed
                     // by two calls of f(intE)
        g('a');      // will cause three calls of f(char)
    }
Date: 2000-04-15.00:00:00

Notes from 04/00 meeting:

The core working group agreed that the example as written is incorrect and should be reformulated to use a class type instead of a fundamental type. It was also decided to open a new issue dealing more generally with Koenig lookup and fundamental types.

(See also issues 213 and 225.)

Date: 2004-09-10.00:00:00

The example in 13.8 [temp.res] paragraph 9 is incorrect, according to 13.8.4.2 [temp.dep.candidate] . The example reads,

    void f(char);

    template <class T> void g(T t)
    {
        f(1);        // f(char);
        f(T(1));     // dependent
        f(t);        // dependent
        dd++;        // not dependent
                     // error: declaration for dd not found
    }

    void f(int);

    double dd;
    void h()
    {
        g(2);        // will cause one call of f(char) followed
                     // by two calls of f(int)
        g('a');      // will cause three calls of f(char)
    }
Since 13.8.4.2 [temp.dep.candidate] says that only Koenig lookup is done from the instantiation context, and since 6.5.4 [basic.lookup.argdep] says that fundamental types have no associated namespaces, either the example is incorrect (and f(int) will never be called) or the specification in 13.8.4.2 [temp.dep.candidate] is incorrect.
History
Date User Action Args
2008-10-05 00:00:00adminsetstatus: wp -> cd1
2006-04-22 00:00:00adminsetstatus: dr -> wp
2005-10-22 00:00:00adminsetmessages: + msg1286
2005-10-22 00:00:00adminsetstatus: ready -> dr
2005-05-01 00:00:00adminsetmessages: + msg1139
2005-05-01 00:00:00adminsetstatus: drafting -> ready
2000-05-21 00:00:00adminsetmessages: + msg348
2000-05-21 00:00:00adminsetstatus: open -> drafting
2000-01-26 00:00:00admincreate