This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/63875] New: Bogus unused-but-set-parameter warning when expanding a variadic template argument pack


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.
          ^


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]