The information in this article applies to:
SYMPTOMSAny reference to a template function that returns a template class by value generates these errors:
RESOLUTIONModify the function to return a reference to the template class instead of returning by value. In the "Sample Code" section of this article, function 'f1' returns a template class by value and fails. Function 'f2' returns a template class by reference and succeeds. STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem was fixed in Microsoft Visual C++, 32-bit Edition, version 4.0. MORE INFORMATIONSample Code
NOTE: Although this has been fixed under Visual C++ 4.0, the definition of
function f2:
causes the following compilation errors:
To avoid this, the return value of that statement should be casted appropriately, as follows:
Additional query words: 2.00 2.10 9.00 9.10
Keywords : kbCompiler kbCPPonly kbVC |
Last Reviewed: January 20, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |