This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 110d. See for the official list.


109. Allowing ::template in using-declarations

Section: 9.9  [namespace.udecl]     Status: NAD     Submitter: Daveed Vandevoorde     Date: 6 Apr 1999

Daveed Vandevoorde : While reading Core issue 11 I thought it implied the following possibility:

    template<typename T>
    struct B {
       template<int> void f(int);

    template<typename T>
    struct D: B<T> {
       using B<T>::template f;
       void g() { this->f<1>(0); } // OK, f is a template

However, the grammar for a using-declaration reads:

and nested-name-specifier never ends in "template".

Is that intentional?

Bill Gibbons :

It certainly appears to be, since we have:

so it would be easier to specify using-declaration as: if the "template" keyword were allowed. There was a discussion about whether a dependent name specified in a using-declaration could be given an "is a type" attribute through the typename keyword; the decision was to allow this. But I don't recall if the "is a template" attribute was discussed.

Rationale (04/99): Any semantics associated with the template keyword in using-declarations should be considered an extension.

Notes from the April 2003 meeting:

See also issues 96 and 11.

We decided to make no change and to close this issue as not-a-defect. This is not needed functionality; the example above, for example, can be written with ->template. This issue has been on the issues list for years as an extension, and there has been no clamor for it.

It was also noted that knowing that something is a template is not enough; there's still the issue of knowing whether it is a class or function template.

Additional note (February, 2011):

This issue is being reopened for further consideration after additional discussion; see messages 18492 through 18499. It was noted that, in addition to the workaround described above for the member function template case, the new alias template facility provides a workaround for the member class template case: instead of

    using T::template X;  // ill-formed

for a class template member X of base class T, one could write

    template<U> using X = typename T::template X<U>;

Rationale (March, 2011):

There was insufficient motivation for a change at this point.