编译器错误 C3738

“calling_convention”:显式实例化的调用约定必须与被实例化的模板的调用约定匹配

建议不要在显式实例化中指定调用约定。 但如果必须指定的话,调用约定必须匹配。

示例

以下示例生成 C3738。

// C3738.cpp
// compile with: /clr
// processor: x86
#include <stdio.h>
template< class T >
void f ( T arg ) {   // by default calling convention is __cdecl
   printf ( "f: %s\n", __FUNCSIG__ );
}

template
void __stdcall f< int > ( int arg );   // C3738
// try the following line instead
// void f< int > ( int arg );

int main () {
   f(1);
   f< int > ( 1 );
}