Microsoft KB Archive/268239

= BUG: C2084 on Overloading Function Templates =

Article ID: 268239

Article Last Modified on 7/5/2005

-

APPLIES TO


 * Microsoft Visual C++ 6.0 Enterprise Edition
 * Microsoft Visual C++ 6.0 Professional Edition
 * Microsoft Visual C++ 6.0 Standard Edition

-



This article was previously published under Q268239



SYMPTOMS
You may receive the following error message if you try to overload a template function that has class templates as parameters:

error C2084: function 'void __cdecl f1(class A,class A)' already has a body

Please refer to the sample code in the &quot;More Information&quot; section for details.



RESOLUTION
See the workaround in the sample code in the &quot;More Information&quot; section.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
The following sample code demonstrates the bug and the workaround: //test.cpp // Compiler option needed: none. //#define WORKAROUND //Uncomment this line to work around the bug. template class A { };

template void f1(A a, A b){} template void f1(A a, A b){} void f1(A a, A b){} //C2084 here. void f1(A a, A b){} //Compiles fine. void f1(A a, A b){} //Compiles fine.
 * 1) ifndef WORKAROUND
 * 1) else
 * 1) endif

int main { A a; A  b; f1(a,b); return 0; }

Additional query words: C2084

Keywords: kbbug kbcpponly kbcompiler KB268239

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.