Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7953 Discussions

Incorrect remark about function parameter pack

Jascha_Wetzel
Beginner
662 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
662 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
0 Kudos
Jascha_Wetzel
Beginner
662 Views
Thank you for your reply. Right, i used the sizeof...() only in the example. The original code uses a function call instead.
0 Kudos
SergeyKostrov
Valued Contributor II
662 Views
Thank you, guys, That is a really interesting example.
0 Kudos
Georg_Z_Intel
Employee
662 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

0 Kudos
Reply