FIX: C2555 with Virtual Function Returning Template Object (184089)
The information in this article applies to:
- Microsoft Visual C++ 4.0
- Microsoft Visual C++ 4.0a
- Microsoft Visual C++ 4.1
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
This article was previously published under Q184089 SYMPTOMS
A virtual function returning a templated class object and a derived class
defining the virtual function, causes the following compiler error:
error C2555: 'MyDerived::TestFunc' : overriding virtual function differs
from 'MyBase::TestFunc' only by return type or calling
convention
RESOLUTION
Define the base class function to be nonvirtual.
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++ .NET.
REFERENCES
(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Mark Hagen, Microsoft Corporation.
Modification Type: | Major | Last Reviewed: | 12/8/2003 |
---|
Keywords: | kbBug kbCompiler kbCPPonly kbfix kbLangCPP kbNoUpdate KB184089 |
---|
|