diff options
author | Douglas Gregor <dgregor@apple.com> | 2013-05-03 23:44:54 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2013-05-03 23:44:54 +0000 |
commit | 79bef7aea4419b75e2cca0f121c6e1a4232bb03c (patch) | |
tree | b036ed4e778643a3e1193c98ed75db678c9e57e4 | |
parent | d99990df0b4aca43a0315b2928ff1b8baf704052 (diff) |
<rdar://problem/13806270> A template argument list is a constant-evaluated context.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181076 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Parse/ParseTemplate.cpp | 3 | ||||
-rw-r--r-- | test/SemaTemplate/temp_arg_nontype.cpp | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp index fd49e7a36d..84b7df7295 100644 --- a/lib/Parse/ParseTemplate.cpp +++ b/lib/Parse/ParseTemplate.cpp @@ -1149,6 +1149,9 @@ bool Parser::IsTemplateArgumentList(unsigned Skip) { /// template-argument-list ',' template-argument bool Parser::ParseTemplateArgumentList(TemplateArgList &TemplateArgs) { + // Template argument lists are constant-evaluation contexts. + EnterExpressionEvaluationContext EvalContext(Actions,Sema::ConstantEvaluated); + while (true) { ParsedTemplateArgument Arg = ParseTemplateArgument(); if (Tok.is(tok::ellipsis)) { diff --git a/test/SemaTemplate/temp_arg_nontype.cpp b/test/SemaTemplate/temp_arg_nontype.cpp index 210b5e463f..24509524b2 100644 --- a/test/SemaTemplate/temp_arg_nontype.cpp +++ b/test/SemaTemplate/temp_arg_nontype.cpp @@ -337,3 +337,12 @@ namespace rdar13000548 { } } + +namespace rdar13806270 { + template <unsigned N> class X { }; + const unsigned value = 32; + struct Y { + X<value + 1> x; + }; + void foo() {} +} |