Microsoft KB Archive/165803

= FIX: Error C2783 - Cannot Deduce Non-Type Template Parameter =

Article ID: 165803

Article Last Modified on 7/5/2005

-

APPLIES TO


 * Microsoft Visual C++ 5.0 Enterprise Edition
 * Microsoft Visual C++ 5.0 Professional Edition

-



This article was previously published under Q165803



SYMPTOMS
The sample code in the MORE INFORMATION section causes the compiler error C2783:

'declaration' : could not deduce template argument for 'identifier'



RESOLUTION
The workaround is to avoid argument deduction by specifying the template-parameter-list when calling the function template.



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

This problem was corrected in Microsoft Visual C++ version 6.0.



MORE INFORMATION
The following sample code demonstrates the problem and the workaround:

SAMPLE
/* Compile options needed: none */

template      struct C      { int a[I] ; };

template      int F(C a)      { return I ; }

int main {         int i;          C<4>  CObj ;

i = F(CObj);

// Workaround: Comment the line above. // Uncomment the following line // i = F<4>(CObj);

return 0 ; }

Keywords: kbbug kbfix kbnoupdate kbvc600fix KB165803

-

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

© Microsoft Corporation. All rights reserved.