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
* [Bug c++/48322] [C++0x] Plural parameter packs are not expanded well
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 ` jason at gcc dot gnu.org
2011-06-15 18:04 ` [Bug c++/48322] [C++0x] Plural variadic " jason at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-25 5:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48322
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011.05.25 04:24:42
CC| |jason at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-25 04:24:42 UTC ---
Reduced, compile-time testcase:
template <class... T> struct tuple;
template <class T> struct tuple<T> { T t; };
template <class T, class U> struct pair;
template<> struct pair<int,double> { };
template <class... Ts>
struct A
{
template <class... Us,
class V = tuple<pair<Ts,Us>...> >
static void f()
{
V v;
}
};
int main()
{
A<int>::f<double>();
}
The problem is that partial instantiation doesn't replace Ts with {int}, but it
does lower the level of Us, so by the time we get to deduction Ts and Us both
have level 1 and so both are replaced with {double}. This will be complicated
to fix.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/48322] [C++0x] Plural variadic parameter packs are not expanded well
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 ` 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
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-06-15 18:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48322
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |paolo.carlini at oracle dot
| |com
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-06-15 18:01:56 UTC ---
*** Bug 49225 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/48322] [C++0x] Plural variadic parameter packs are not expanded well
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
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-21 2:18 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48322
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2011-11-21 02:04:59 UTC ---
Author: jason
Date: Mon Nov 21 02:04:54 2011
New Revision: 181547
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181547
Log:
PR c++/48322
gcc/cp/
* cp-tree.h (PACK_EXPANSION_EXTRA_ARGS): New.
* cp-tree.def (EXPR_PACK_EXPANSION): Add an operand for it.
* pt.c (tsubst_pack_expansion): Set and use it.
(iterative_hash_template_arg): Hash it.
(template_args_equal): Compare it.
(comp_template_args_with_info): Handle nulls.
* tree.c (cp_walk_subtrees): Walk it.
* typeck.c (structural_comptypes): Compare it.
* ptree.c (cxx_print_type): Print it.
libstdc++-v3/
* include/std/tuple (tuple(_UElements&&...)): Fix SFINAE.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/variadic120.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-tree.def
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/pt.c
trunk/gcc/cp/ptree.c
trunk/gcc/cp/tree.c
trunk/gcc/cp/typeck.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/cpp0x/sfinae26.C
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/std/tuple
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/48322] [C++0x] Plural variadic parameter packs are not expanded well
2011-03-28 19:48 [Bug c++/48322] New: [C++0x] Plural parameter packs are not expanded well gintensubaru at gmail dot com
` (2 preceding siblings ...)
2011-11-21 2:18 ` jason at gcc dot gnu.org
@ 2011-11-21 3:07 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-21 3:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48322
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.7.0
--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2011-11-21 02:18:34 UTC ---
Fixed for 4.7.
^ 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).