这是我的代码,gcc编译通过,运行成功,clang编译不通过
原谅我写的这么复杂,项目里有用到这个,现在要用clang编译,这个就不通过了,我的项目有大量的reinterpret_cast<bool (*)(...)>转换不同的方法,所以这块逻辑有没有可替代的方法,让clang编译通过
clang-14
c++17
gcc 9.4
#include <iostream>
#include <string>
#include <vector>
using namespace std;
bool (*ins_func)(...);
bool save(int a,vector<long> arr)
{
cout << a << endl;
cout << " hello " << endl;
return true;
}
template <typename T, typename... Args>
bool sum_super_cool(T v, Args... args) {
cout << "pre" << endl;
bool ret = (*ins_func)(std::forward<Args>(args)...);
return ret;
}
int main(int argc, char** argv) {
ins_func = reinterpret_cast<bool (*)(...)>(&save);
vector<long> arr;
arr.push_back(123);
sum_super_cool(1, 2, arr);
return 0;
}
clang 是对的,程序不合法。
expr.call