<rdar://problem/13806270> A template argument list is a constant-evaluated context.

llvm-svn: 181076
This commit is contained in:
Douglas Gregor 2013-05-03 23:44:54 +00:00
parent 3880c4cebd
commit b4eadc34e1
2 changed files with 12 additions and 0 deletions

View File

@ -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)) {

View File

@ -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() {}
}