FIX: C2670: Template Function Cannot Convert Parameter (148808)
The information in this article applies to:
- Microsoft Visual C++, 32-bit Professional Edition 4.0
- Microsoft Visual C++, 32-bit Learning Edition 4.0
This article was previously published under Q148808 SYMPTOMS
The following error is generated:
error C2670: 'AFunction' : the template function cannot convert
parameter 1 from type 'class Derived<int> *'
in code containing all of the following:
- A template class 'Derived' from another template class 'Base'.
- 'AFunction' taking a pointer to the 'Base' as a parameter.
- A call to the 'AFunction' passing a pointer to 'Derived' before
instantiating any object of that type.
See the sample code in this article for an example.
RESOLUTION
To work around this problem, either explicitly instantiate 'Derived' or
create a dummy object of type 'Derived' before calling the 'AFunction'.
See the Sample Code for an example.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. This problem was corrected in Microsoft
Visual C++, 32-bit Edition, version 4.1.
Modification Type: | Minor | Last Reviewed: | 7/5/2005 |
---|
Keywords: | kbbug kbcode kbCompiler kbCPPonly kbfix KB148808 |
---|
|