Topic: Defect Report: Template parameters not allowed in nested names


Author: Martin von Loewis <loewis@informatik.hu-berlin.de>
Date: 2000/03/13
Raw View

[ Moderator's comment: forwarded to C++ committee. The other DR
  from Martin von Loewis and Martin Sebor was also forwarded. -sdc ]

According to 14.1, [temp.param]/3, the following fragment is
ill-formed:

template<class T>
class X{
  friend void T::foo();
};

In the friend declaration, the 'T::' part is a nested-name-specifier
(8, [dcl.decl]/4), and 'T' must be a class-name or a namespace-name
(5.1, [expr.prim]/7). However, according to [temp.param]/3, it is only
a type-name. The fragment should be well-formed, and instantiations of
the template allowed as long as the actual template argument is a
class which provides a function member foo. As a result of this
defect, any usage of template parameters in nested names is
ill-formed, eg. in the example of 14.6, [temp.res]/2.

If you have questions about this report, please let me know.

Martin



[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: Martin von Loewis <loewis@informatik.hu-berlin.de>
Date: 2000/03/14
Raw View
[Forwarded to standardization committee. -mha]

According to 14.1, [temp.param]/3, the following fragment is
ill-formed:

template<class T>
class X{
  friend void T::foo();
};

In the friend declaration, the 'T::' part is a nested-name-specifier
(8, [dcl.decl]/4), and 'T' must be a class-name or a namespace-name
(5.1, [expr.prim]/7). However, according to [temp.param]/3, it is only
a type-name. The fragment should be well-formed, and instantiations of
the template allowed as long as the actual template argument is a
class which provides a function member foo. As a result of this
defect, any usage of template parameters in nested names is
ill-formed, eg. in the example of 14.6, [temp.res]/2.

If you have questions about this report, please let me know.

Martin
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern/std-c++/faq.html                  ]