Title
Allowing ::template in using-declarations
Status
nad
Section
9.9 [namespace.udecl]
Submitter
Daveed Vandevoorde

Created on 1999-04-06.00:00:00 last changed 166 months ago

Messages

Date: 2011-02-15.00:00:00

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.

Date: 2011-02-15.00:00:00

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.

Date: 2003-04-15.00:00:00

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.

Date: 2022-02-18.07:47:23

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:

    using typenameopt ::opt nested-name-specifier unqualified-id ;

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

Is that intentional?

Bill Gibbons :

It certainly appears to be, since we have:

    qualified-id:
      ::opt nested-name-specifier templateopt unqualified-id
so it would be easier to specify using-declaration as:
    using typenameopt qualified-id ;
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.

History
Date User Action Args
2011-04-10 00:00:00adminsetstatus: open -> nad
2011-02-28 00:00:00adminsetmessages: + msg3248
2011-02-28 00:00:00adminsetstatus: nad -> open
2003-04-25 00:00:00adminsetmessages: + msg880
2003-04-25 00:00:00adminsetstatus: open -> nad
2002-11-08 00:00:00adminsetstatus: extension -> open
1999-09-14 00:00:00adminsetmessages: + msg201
1999-04-06 00:00:00admincreate