Movatterモバイル変換


[0]ホーム

URL:


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

2025-12-20


228. Use oftemplate keyword with non-member templates

Section:13.3  [temp.names]    Status:CD1    Submitter:Daveed Vandevoorde    Date:4 May 2000

[Voted into WP at April 2003 meeting.]

Consider the following example:

    template<class T>    struct X {       virtual void f();    };    template<class T>    struct Y {       void g(X<T> *p) {  p->template X<T>::f();       }    };

This is an error becauseX is not a member template;13.3 [temp.names] paragraph 5 says:

If a name prefixed by the keywordtemplate is not the nameof a member template, the program is ill-formed.

In a way this makes perfect sense:X is found to be a templateusing ordinary lookup even thoughp has a dependent type.However, I think this makes the use of thetemplate prefixeven harder to teach.

Was this intentionally outlawed?

Proposed Resolution (4/02):

Elide the first use of the word "member" in13.3 [temp.names] paragraph 5 so that its first sentence reads:

If a name prefixed by the keywordtemplate is not the name of amember template, the program is ill-formed.



[8]ページ先頭

©2009-2026 Movatter.jp