FIX: Template Keyword Can't Be Used Inside Class Declarations (148704)
The information in this article applies to:
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 4.1
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 4.2
This article was previously published under Q148704 SYMPTOMS
Any attempt to use the keyword 'template' within a class definition results
in the following two errors:
error C2059: syntax error : 'template'
error C2238: unexpected token(s) preceding ';'
RESOLUTION
The resolution will vary according to the circumstances. For example, when
declaring a template function to be a friend of a non-template class, find
another way to manipulate the members of the class; for example, declare
them to be public instead of private or provide public access member
functions.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. This bug was corrected in Visual C++
version 5.0.
Modification Type: | Minor | Last Reviewed: | 7/5/2005 |
---|
Keywords: | kbbug kbCompiler kbCPPonly kbfix kbLangCPP kbVC500fix KB148704 |
---|
|