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

2024-11-11


687. template keyword with unqualified-ids

Section: _N4567_.5.1.1  [expr.prim.general]     Status: NAD     Submitter: Mihai Rusu     Date: 27 February, 2008

[Addressed with a different approach by paper P0846R0, adopted at the November, 2017 meeting.]

Consider the following:

    namespace N {
        struct A { };
        template<typename T>
        T func(const A&) { return T(); }
    }

    void f() {
        N::A a;
        func<int>(a);    // error
    }

Although argument-dependent lookup would allow N::func to be found in this call, the < is taken as a less-than operator rather than as the beginning of a template argument list. If the use of the template keyword for syntactic disambiguation were permitted for unqualified-ids, this problem could be solved by prefixing the function name with template, allowing the template-id to be parsed and argument-dependent lookup to be performed.

Rationale (July, 2009):

This suggestion would need a full proposal and discussion by the EWG before the CWG could consider it.