aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r--lib/Sema/SemaTemplate.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index d38bffd9e3..088e0193a5 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -3463,7 +3463,16 @@ Sema::BuildExpressionFromIntegralTemplateArgument(const TemplateArgument &Arg,
T,
Loc));
- return Owned(IntegerLiteral::Create(Context, *Arg.getAsIntegral(), T, Loc));
+ QualType BT;
+ if (const EnumType *ET = T->getAs<EnumType>())
+ BT = ET->getDecl()->getPromotionType();
+ else
+ BT = T;
+
+ Expr *E = IntegerLiteral::Create(Context, *Arg.getAsIntegral(), BT, Loc);
+ ImpCastExprToType(E, T, CK_IntegralCast);
+
+ return Owned(E);
}