Movatterモバイル変換


[0]ホーム

URL:


Issue 183 - WG21 CWG Issues
Title
typename in explicit specializations
Status
tc1
Section
13.8 [temp.res]
Submitter
John Spicer

Created on1999-11-09.00:00:00 last changed277 months ago

Messages

msg325 (view)
Date: 2000-04-15.00:00:00

Proposed resolution (10/00):

In 13.8 [temp.res] paragraph 5, replace

The keywordtypename shall only be applied to qualifiednames, but those names need not be dependent.

with

The keywordtypename shall be applied only to qualifiednames, but those names need not be dependent. The keywordtypename shall be used only in contexts in which dependentnames can be used. This includes template declarations anddefinitions but excludes explicit specialization declarations andexplicit instantiation declarations.
msg270 (view)
Date: 2020-12-15.00:00:00

John Spicer:In 13.8 [temp.res] paragraph 5,the standard says

The keywordtypename shall only be used intemplate declarations and definitions...
My understanding of the intent of this restriction is to say thattypename is only allowed in contexts in which templatedependent names can be found, but the wording leaves open tointerpretation whethertypename is allowed in an explicitspecialization, such as:
    template <class T> struct A {};    template <class T> struct B { typedef int X; };    template <> struct A<int> {        typename B<int>::X x;    };
My understanding is that such usage is not permitted.This should be clarified one way or the other.

Mike Miller:I agree with your understanding that you are not allowed tousetypename in an explicit specialization. However, I thinkthe standard already says that — an explicit specializationis not a template declaration. According to the grammar inClause 13 [temp] paragraph 1, atemplate-declaration must have a non-emptytemplate-parameter-list.

Nathan Myers:Is there any actual reason for this restriction? Its only apparenteffect is to make it harder to specialize templates, with nocorresponding benefit.

History
DateUserActionArgs
2003-04-25 00:00:00adminsetstatus: dr -> tc1
2000-11-18 00:00:00adminsetstatus: ready -> dr
2000-05-21 00:00:00adminsetmessages: +msg325
2000-05-21 00:00:00adminsetstatus: open -> ready
1999-11-09 00:00:00admincreate

[8]ページ先頭

©2009-2026 Movatter.jp