Incorrect remark about function parameter pack

Incorrect remark about function parameter pack

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.

publicaciones de 5 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

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

Thank you for your reply.

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

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

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

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya