FIX: Template Keyword Can't Be Used Inside Class Declarations
Article ID: 148704
Article Last Modified on 7/5/2005
APPLIES TO
- Microsoft Visual C++ 4.0 Standard Edition
- Microsoft Visual C++ 4.1 Subscription
- Microsoft Visual C++ 4.2 Enterprise Edition
- Microsoft Visual C++ 4.2 Professional Edition
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.
Additional query words: kbVC400bug 10.0 10.00 10.1 10.10 10.20
Keywords: kbbug kbfix kblangcpp kbvc500fix kbcpponly kbcompiler KB148704