]> granicus.if.org Git - clang/commitdiff
<rdar://problem/13806270> A template argument list is a constant-evaluated context.
authorDouglas Gregor <dgregor@apple.com>
Fri, 3 May 2013 23:44:54 +0000 (23:44 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 3 May 2013 23:44:54 +0000 (23:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181076 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseTemplate.cpp
test/SemaTemplate/temp_arg_nontype.cpp

index fd49e7a36dd117567b874b068266bd2e46ddb867..84b7df7295f669e36b4e759870225dec4c63defe 100644 (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)) {
index 210b5e463f635b99aa1a19295229212cd8f9bef4..24509524b294c0b1de6967f16492839882d892f4 100644 (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() {}
+}