Incorrect remark about function parameter pack

Incorrect remark about function parameter pack

Jascha Wetzel的头像

Compiling

template<class... Args>
int g(Args... args)
{ return sizeof...(args); }
int main() {
    g(1);
    g(1, 2);
    g(1, 2, 3);
}

with
icl /Qstd:c++0x /W4 templ_var_args_warning.cpp

results in
templ_var_args_warning.cpp(2): remark #869: parameter "args" was never referenced
  int g(Args... args)
                ^
          detected during instantiation of "int g(Args...) [with Args=<int, int, int>]" at line 7

Note that the first two instantiations of g() do not produce the remark.
This is happening with ICC Version 13.0.1.119 Build 20121008 and older versions.

4 帖子 / 0 new
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项.
Georg Zitzlsberger (Intel)的头像

Hello,

that seems like a bug. I've filed a defect (DPD200239284) and let you know about the progress.
In your example above, it would be better to use this instead


template

int g(Args...)

{ return sizeof...(Args); }

...to not get the warning. But I agree, using the identifier of the parameter pack (args) instead has to work as well.

Best regards,

Georg Zitzlsberger

Jascha Wetzel的头像

Thank you for your reply.

Right, i used the sizeof...() only in the example. The original code uses a function call instead.

Sergey Kostrov的头像

Thank you, guys, That is a really interesting example.

登陆并发表评论。