[Bug c++/56958] Spurious set but not used variable warning in empty pack expansion
will at benfold dot com
gcc-bugzilla@gcc.gnu.org
Thu Jun 21 08:42:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56958
Will Benfold <will at benfold dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |will at benfold dot com
--- Comment #5 from Will Benfold <will at benfold dot com> ---
Still present in 7.3.0:
----------------------------------------------------------------
$ cat test.cpp
template<int...Is>
int foo (int n)
{
return (( (n) + Is ) + ... + 0);
}
int main (int, char *[])
{
foo<1>(0);
foo<>(0);
return 0;
}
$ g++ -std=c++17 -Wall -Wextra -o test test.cpp
test.cpp: In instantiation of ‘int foo(int) [with int ...Is = {}]’:
test.cpp:10:10: required from here
test.cpp:2:14: warning: parameter ‘n’ set but not used
[-Wunused-but-set-parameter]
int foo (int n)
----------------------------------------------------------------
The warning goes away if the parentheses are removed from (n), or if it's
changed to (n+0).
More information about the Gcc-bugs
mailing list