Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 79bef7a

Browse files
committed
<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
1 parent d99990d commit 79bef7a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Diff for: lib/Parse/ParseTemplate.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,9 @@ bool Parser::IsTemplateArgumentList(unsigned Skip) {
11491149
/// template-argument-list ',' template-argument
11501150
bool
11511151
Parser::ParseTemplateArgumentList(TemplateArgList &TemplateArgs) {
1152+
// Template argument lists are constant-evaluation contexts.
1153+
EnterExpressionEvaluationContext EvalContext(Actions,Sema::ConstantEvaluated);
1154+
11521155
while (true) {
11531156
ParsedTemplateArgument Arg = ParseTemplateArgument();
11541157
if (Tok.is(tok::ellipsis)) {

Diff for: test/SemaTemplate/temp_arg_nontype.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -337,3 +337,12 @@ namespace rdar13000548 {
337337
}
338338

339339
}
340+
341+
namespace rdar13806270 {
342+
template <unsigned N> class X { };
343+
const unsigned value = 32;
344+
struct Y {
345+
X<value + 1> x;
346+
};
347+
void foo() {}
348+
}

0 commit comments

Comments
 (0)