CWG Issue 109 (original) (raw)
This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-11-05
109. Allowing ::template in _using-declaration_s
Section: 9.10 [namespace.udecl]Status: NADSubmitter: Daveed VandevoordeDate: 6 Apr 1999
_Daveed Vandevoorde :_While reading Core issue 11I 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 thetypename 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 thetemplate keyword in _using-declaration_s should be considered an extension.
Notes from the April 2003 meeting:
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 messages18492 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-formedfor 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.