[Sema] Fix a bug where pack expansion was not expanded in type alias
The problem is that the parameter pack in a function type type alias is not
reexpanded after being transformed. Also remove an incorrect comment in a
similar function. Fixes PR26017.
Differential Revision: http://reviews.llvm.org/D21030
llvm-svn: 274566
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index b13dc34..88acc20 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -3327,8 +3327,6 @@
if (Out.isInvalid())
return true;
- // FIXME: Can this happen? We should not try to expand the pack
- // in this case.
if (Out.get()->containsUnexpandedParameterPack()) {
Out = getDerived().RebuildPackExpansion(
Out.get(), Expansion->getEllipsisLoc(), OrigNumExpansions);
@@ -4822,6 +4820,14 @@
if (NewType.isNull())
return true;
+ if (NewType->containsUnexpandedParameterPack()) {
+ NewType =
+ getSema().getASTContext().getPackExpansionType(NewType, None);
+
+ if (NewType.isNull())
+ return true;
+ }
+
if (ParamInfos)
PInfos.set(OutParamTypes.size(), ParamInfos[i]);
OutParamTypes.push_back(NewType);