PR c++/56782 - Regression with empty pack expansions
commit907743e7d7bb1375e88adb52d7656438fa135de4
authordodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 16 May 2013 06:14:49 +0000 (16 06:14 +0000)
committerdodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 16 May 2013 06:14:49 +0000 (16 06:14 +0000)
treec6b464617b7d00a515b81b19e8d79595d99f21d2
parent12c2172df734a83580f4bf14409fb0aad7c2c8b7
PR c++/56782 - Regression with empty pack expansions

In the example of the patch below, during the instantiation of
is_convertible at #1, we see at some point Tuple<>.  (Let's note '{}'
an empty argument pack.)  In that context, during the partial
specialization the member template

template<class... U>
Tuple<>::Tuple<U,
       typename enable_if<and_<is_convertible<U, {}>...
                                      >::value,
                                  int
         >::type
              >

Let's look at what happens to the expansion "is_convertible<U, {}>...."

To express the result of that expansion tsubst_pack_expansion receives
the expansion is_convertible<U, T>, with the argument list [{}].  This
function should detect that we have an empty argument pack for the
parameter pack T and no argument pack for the parameter pack U.  It
should thus return a pack expansion "is_convertible<U,T>..." that has this
information: "I have gotten an argument list, that is not complete
because U doesn't have any argument pack; the argument pack for T is
'{}', so I'll wait for the next time I am passed to
tsubst_pack_expansion with enough additional argument packs, to really
perform the substitution".  That information is conveyed by attaching
the the '{}' to the PACK_EXPANSION_EXTRA property of the pack expansion
returned by tsubst_pack_expansion.

The problem in this report is that we are not setting
PACK_EXPANSION_EXTRA when the non-complete argument pack list is made
of an empty argument pack, because use_pack_expansion_extra_args_p
doesn't detect this case.

Fixed thus.

gcc/cp/

* pt.c (use_pack_expansion_extra_args_p): When at least a
parameter pack has an empty argument pack, and another parameter
pack has no argument pack at all, use the PACK_EXPANSION_EXTRA
mechanism.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198956 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp0x/variadic143.C [new file with mode: 0644]