diff options
| author | John McCall <rjmccall@apple.com> | 2011-07-15 07:47:58 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2011-07-15 07:47:58 +0000 |
| commit | 6730e4d904d02814325a370d06eb01880009730f (patch) | |
| tree | 00edccab7bcd79554f15ac60015dfc43787bd862 /clang/lib | |
| parent | 1bf4a30d4d3310d860950d15bcb89a8b112da39c (diff) | |
| download | bcm5719-llvm-6730e4d904d02814325a370d06eb01880009730f.tar.gz bcm5719-llvm-6730e4d904d02814325a370d06eb01880009730f.zip | |
Restore the C-style cast hack for enum template arguments,
which is required given the current setup for template
argument deduction substitution validation, and add a test
case to make sure we don't break it in the future.
llvm-svn: 135262
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 2514b48de31..3ac190e1d4c 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -4152,7 +4152,16 @@ Sema::BuildExpressionFromIntegralTemplateArgument(const TemplateArgument &Arg, else BT = T; - return Owned(IntegerLiteral::Create(Context, *Arg.getAsIntegral(), BT, Loc)); + Expr *E = IntegerLiteral::Create(Context, *Arg.getAsIntegral(), BT, Loc); + if (T->isEnumeralType()) { + // FIXME: This is a hack. We need a better way to handle substituted + // non-type template parameters. + E = CStyleCastExpr::Create(Context, T, VK_RValue, CK_IntegralCast, E, 0, + Context.getTrivialTypeSourceInfo(T, Loc), + Loc, Loc); + } + + return Owned(E); } /// \brief Match two template parameters within template parameter lists. |

