This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/63875] New: Bogus unused-but-set-parameter warning when expanding a variadic template argument pack
- From: "tejohnson at google dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 14 Nov 2014 17:04:16 +0000
- Subject: [Bug c++/63875] New: Bogus unused-but-set-parameter warning when expanding a variadic template argument pack
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63875
Bug ID: 63875
Summary: Bogus unused-but-set-parameter warning when expanding
a variadic template argument pack
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tejohnson at google dot com
The following test case warns about a variable that is set but unused. The
parameter is unused when the argument pack has nothing in it, but it is never
set.
% cat b.cc
template <class... Ts>
void Sink(Ts...) {}
struct S {
int Get(int) { return 0; }
};
template <int... Is>
void F(S s) {
Sink(s.Get(Is)...);
}
int main() {
F<>({});
}
$ g++ -c -O b.cc -std=c++11 -Wall -Wunused-but-set-parameter
b.cc: In instantiation of 'void F(S) [with int ...Is = {}]':
b.cc:14:9: required from here
b.cc:9:10: warning: parameter 's' set but not used [-Wunused-but-set-parameter]
void F(S s) {
Google ref b/10709546.
^