请考虑以下代码,该代码使用带有可变参数的函数:
#include// Typedef function type template using Func = void(Output*...); // Function runner template void run_func(Func & func, Output*... output) { for (int i=0 ; i < 10 ; ++i) { func(output...); } } void f(double* d) { *d *= 2; }; int main() { double value = 1.0; run_func(f, &value); printf("%f\n", value); }
用g ++ 4.7.3编译它可以正常工作,并且运行1024.0
按预期生成.
使用icpc 14.0.2进行编译会使其崩溃...
templ.cc(21): internal error: assertion failed: lower_expr: bad kind (shared/cfe/edgcpfe/lower_il.c, line 18582) run_func(f, &value); ^
使用clang 3.5.0-1进行编译会出现以下错误消息:
templ.cc:21:3: error: no matching function for call to 'run_func' run_func(f, &value); ^~~~~~~~ templ.cc:9:6: note: candidate template ignored: deduced conflicting types for parameter 'Output' ('double' vs.) void run_func(Func & func, Output*... output) { ^
这是一个错误,还是应该让g ++不编译?
为什么铛演绎这些"冲突的"类型的double
和
,是
指代表例如解压的arglist?
更新 icpc 14.0.3不会崩溃,程序编译并正确运行.
请参阅英特尔 ®ComposerXE 2013 SP1编译器修复列表中的 DPD200244439