public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48322] New: [C++0x] Plural parameter packs are not expanded well
@ 2011-03-28 19:48 gintensubaru at gmail dot com
  2011-05-25  5:08 ` [Bug c++/48322] " jason at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gintensubaru at gmail dot com @ 2011-03-28 19:48 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [C++0x] Plural parameter packs are not expanded well
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gintensubaru@gmail.com


Source Code (bug.cc):


#include <typeinfo>
#include <cxxabi.h>
#include <cstdlib>
#include <iostream>

template<class T>
void print_typename()
{
  int status = 0;
  char* const name = abi::__cxa_demangle( typeid(T).name(), 0, 0, &status );
  std::cout << name << std::endl;
  std::free( name );
}

#include <type_traits>
#include <utility>
#include <tuple>

template<class... Ts>
struct X
{
  template< class... Us,
    class Tuple = std::tuple<
      std::pair<Ts, Us>...
    >
  >
  static void test( Us... ) {
    print_typename<Tuple>();
  }

};

int main()
{
                     // expected
  X<>::test();       // std::tuple<>
  X<int>::test(1);   // std::tuple<std::pair<int, int>>
  X<int>::test(1.0); // std::tuple<std::pair<int, double>>

  X<>::test(1);      // no matching function
  X<int>::test();    // no matching function
}



Output:

std::tuple<>
std::tuple<std::pair<int, int> >
std::tuple<std::pair<double, double> >
std::tuple<std::pair<int, int> >
std::tuple<>


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

end of thread, other threads:[~2011-11-21  2:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-28 19:48 [Bug c++/48322] New: [C++0x] Plural parameter packs are not expanded well gintensubaru at gmail dot com
2011-05-25  5:08 ` [Bug c++/48322] " jason at gcc dot gnu.org
2011-06-15 18:04 ` [Bug c++/48322] [C++0x] Plural variadic " jason at gcc dot gnu.org
2011-11-21  2:18 ` jason at gcc dot gnu.org
2011-11-21  3:07 ` jason 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).