public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49251] New: [C++0x][parameter pack expanding] unused parameter warning with unpacking empty tuples
@ 2011-06-01  8:24 gintensubaru at gmail dot com
  2011-06-15 17:31 ` [Bug c++/49251] " jason at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gintensubaru at gmail dot com @ 2011-06-01  8:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49251

           Summary: [C++0x][parameter pack expanding] unused parameter
                    warning with unpacking empty tuples
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gintensubaru@gmail.com


#include <tuple>

template< std::size_t... Indices >
struct indices {};

template< class... Args >
void sink( Args&&... ) {}

template< class Tuple, std::size_t... Indices >
void unpack_test( Tuple && t, indices<Indices...> ) {
  sink( std::get<Indices>(t)... );
}

int main() {
  unpack_test( std::tuple<>(), indices<>() );
}


------------------------


This code, which is unpacking tuples, raises unused parameter warning:

$ g++ -std=c++0x -Wunused-parameter bug.cc

bug.cc: In instantiation of 'void unpack_test(Tuple&&, indices<Indices ...>)
[with Tuple = std::tuple<>, unsigned int ...Indices = {}]':
bug.cc:15:44:   instantiated from here
bug.cc:10:6: warning: unused parameter 't' [-Wunused-parameter]


I've confirmed this behavior on following versions:

4.5.0
4.5.3
4.6.0
4.6-20110527
4.7-20110528


It can be avoided by using the parameter explicitly, like `(void)t;',
but it's not always used.
( For example, it cannot be used for constexpr functions. )


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-08-29 12:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-01  8:24 [Bug c++/49251] New: [C++0x][parameter pack expanding] unused parameter warning with unpacking empty tuples gintensubaru at gmail dot com
2011-06-15 17:31 ` [Bug c++/49251] " jason at gcc dot gnu.org
2011-06-15 18:07 ` jason at gcc dot gnu.org
2011-06-16 22:14 ` jason at gcc dot gnu.org
2011-06-17  1:08 ` jason at gcc dot gnu.org
2011-06-17  1:11 ` jason at gcc dot gnu.org
2011-08-29 12:52 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).