]> granicus.if.org Git - clang/commitdiff
Correctly handle packs for variadic type traits.
authorEli Friedman <eli.friedman@gmail.com>
Fri, 19 Jul 2013 21:49:32 +0000 (21:49 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Fri, 19 Jul 2013 21:49:32 +0000 (21:49 +0000)
I'm not sure how to write a test for this; the following shows the
difference in -ast-dump:

template <int x> struct A {};
template <class T> struct B { };
template <class ...Args> using C = A<(__is_trivially_constructible(Args...))>;
template <class ...Args> using D = C<B<Args>...>;

However, I can't seem to write a test that triggers a visible difference
in behavior.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186726 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/TreeTransform.h

index ef8049af84388399fa07e0a2b9f9e135306fdd1b..34fdbad87b3401a5648a83202b1aeb3193207aa3 100644 (file)
@@ -7926,6 +7926,19 @@ TreeTransform<Derived>::TransformTypeTraitExpr(TypeTraitExpr *E) {
       if (To.isNull())
         return ExprError();
 
+      if (To->containsUnexpandedParameterPack()) {
+        To = getDerived().RebuildPackExpansionType(To,
+                                                   PatternTL.getSourceRange(),
+                                                   ExpansionTL.getEllipsisLoc(),
+                                                   NumExpansions);
+        if (To.isNull())
+          return ExprError();
+
+        PackExpansionTypeLoc ToExpansionTL
+          = TLB.push<PackExpansionTypeLoc>(To);
+        ToExpansionTL.setEllipsisLoc(ExpansionTL.getEllipsisLoc());
+      }
+
       Args.push_back(TLB.getTypeSourceInfo(SemaRef.Context, To));
     }