我一直在尝试编译一个项目(使用gcc/g ++很好),其中clang和compilation卡在模板调用上.我试图创建最简单的类似代码,显示相同的错误消息.这里是:
#include <vector>
#include <utility>
#include <iostream>
using namespace std;
int A( double in )
{
return 1;
}
int A( int in )
{
return 1;
}
template<class M, class T>
M test(T input, M (fun) (T) )
{
return fun( input );
}
int main( int argc, const char *argv[] )
{
cout << test( (int) 1, A ) << test( (double) 1.2, A ) << endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
来自clang的错误(当然会出现两次):
error: no matching function for call …Run Code Online (Sandbox Code Playgroud)