Created on 2006-06-15.00:00:00 last changed 197 months ago
Rationale (September, 2008):
The proposed extension is not needed. The template case can be handled simply by providing a template header:
template <typename T> friend class X<T>;
Proposed resolution (June, 2008):
Change 11.8.4 [class.friend] paragraph 3 as follows:
A friend declaration that does not declare a function shall have one of the following forms:
friend elaborated-type-specifier ;
friend simple-type-specifier ;
friend typename-specifier ;
friend ::opt nested-name-specifieropt template-name ;
friend identifier ;
In the last alternative, the identifier shall name a template template-parameter. [Note: a friend declaration may be the declaration in a template-declaration (Clause 13 [temp], 13.7.5 [temp.friend]). —end note] If the
type specifier in afriend declaration designates a (possibly cv-qualified) class type or a class template, that class or template is declared as a friend; otherwise, the friend declaration is ignored. [Example:...
After the adoption of the wording for extended friend declarations, we now have this new paragraph in 11.8.4 [class.friend]:
A friend declaration that does not declare a function shall have one of the following forms:
friend elaborated-type-specifier ;
friend simple-type-specifier ;
friend typename-specifier ;
But what about friend class templates? Should the following examples compile in C++0x?
template< template <class> class T > struct A{ friend T; }; template< class > struct C; struct B{ friend C; };
History | |||
---|---|---|---|
Date | User | Action | Args |
2008-10-05 00:00:00 | admin | set | messages: + msg1834 |
2008-10-05 00:00:00 | admin | set | status: review -> nad |
2008-06-29 00:00:00 | admin | set | messages: + msg1683 |
2008-06-29 00:00:00 | admin | set | status: drafting -> review |
2006-11-05 00:00:00 | admin | set | status: open -> drafting |
2006-06-15 00:00:00 | admin | create |