Allow us to transform pack expansion expressions.

llvm-svn: 123349
This commit is contained in:
Douglas Gregor 2011-01-13 00:19:55 +00:00
parent fd4344b5a6
commit 0f836ea213
2 changed files with 24 additions and 2 deletions

View File

@ -6787,8 +6787,14 @@ TreeTransform<Derived>::TransformCXXNoexceptExpr(CXXNoexceptExpr *E) {
template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformPackExpansionExpr(PackExpansionExpr *E) {
llvm_unreachable("pack expansion expression in unhandled context");
return ExprError();
ExprResult Pattern = getDerived().TransformExpr(E->getPattern());
if (Pattern.isInvalid())
return ExprError();
if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
return SemaRef.Owned(E);
return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc());
}
template<typename Derived>

View File

@ -56,4 +56,20 @@ namespace rdar8848837 {
X<int(float, double)> xif;
template<unsigned> struct unsigned_c { };
template<typename ...ArgTypes> int g(ArgTypes...);
template<typename F> struct X1;
template<typename R, typename ...ArgTypes>
struct X1<R(ArgTypes...)> {
unsigned_c<sizeof(1 + g(ArgTypes()...))> f();
};
template<typename R, typename ...ArgTypes>
unsigned_c<sizeof(1 + g(ArgTypes()...))> X1<R(ArgTypes...)>::f() {
return unsigned_c<sizeof(int)>();
}
X1<int(float, double)> xif2;
}