Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
7691 Discussions

Incorrect remark about function parameter pack

Jascha_Wetzel
Beginner
373 Views

Compiling
[cpp]
template<class... Args>
int g(Args... args)
{ return sizeof...(args); }
int main() {
    g(1);
    g(1, 2);
    g(1, 2, 3);
}[/cpp]
with
[plain]icl /Qstd:c++0x /W4 templ_var_args_warning.cpp[/plain]
results in
[plain]
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[/plain]
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.

0 Kudos
4 Replies
Georg_Z_Intel
Employee
373 Views
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 [cpp] template int g(Args...) { return sizeof...(Args); } [/cpp] ...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
Beginner
373 Views
Thank you for your reply. Right, i used the sizeof...() only in the example. The original code uses a function call instead.
SergeyKostrov
Valued Contributor II
373 Views
Thank you, guys, That is a really interesting example.
Georg_Z_Intel
Employee
373 Views

Hello,

the defect in question will be fixed with a future version of our compiler (not 15.0, but next major version).

Best regards,

Georg Zitzlsberger

Reply