[PATCH] Fix incorrect substitution substituting into variadic alias template

Richard Smith richard at metafoo.co.uk
Wed Jul 17 18:01:27 PDT 2013


On Wed, Jul 17, 2013 at 5:43 PM, Eli Friedman <eli.friedman at gmail.com>wrote:

> Patch attached.  Fixes PR16646.  The concept is that when substitution
> replaces a pack with another pack, we don't want to expand the pack
> immediately: we want to expand it at the same level as the original
> pack.
>

How do we ensure that the we retain a pack expansion around the transformed
entity?


> I'm not confident that this patch is correct, though: just stripping
> off the PackExpansionType in the middle of instantiation seems weird.
> Also, I'm not sure what other tests would be relevant.


The patch only covers type template parameters; presumably, the same issue
applies to non-type template parameters and template template parameters?

Does this correctly handle expanding the pack into a fixed set of
parameters and a pack, in cases like:

template<typename ...Ts> struct S {};
template<typename ...Ts> using X = S<S<Ts>...>;
template<typename ...Ts> void f(X<int, Ts...> x);
void g() { f(X<int, int, int>()); }

? (I think it should, but this seems worth testing.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130717/cd99d605/attachment.html>


More information about the cfe-commits mailing list