[cfe-commits] r155670 - in /cfe/trunk: lib/Parse/ParseTemplate.cpp lib/Sema/SemaTemplate.cpp test/SemaTemplate/default-expr-arguments.cpp

Eli Friedman eli.friedman at gmail.com
Thu Apr 26 15:43:24 PDT 2012


Author: efriedma
Date: Thu Apr 26 17:43:24 2012
New Revision: 155670

URL: http://llvm.org/viewvc/llvm-project?rev=155670&view=rev
Log:
Add a missing ExpressionEvaluationContext for template default arguments.  Fixes PR12581.


Modified:
    cfe/trunk/lib/Parse/ParseTemplate.cpp
    cfe/trunk/lib/Sema/SemaTemplate.cpp
    cfe/trunk/test/SemaTemplate/default-expr-arguments.cpp

Modified: cfe/trunk/lib/Parse/ParseTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTemplate.cpp?rev=155670&r1=155669&r2=155670&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseTemplate.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTemplate.cpp Thu Apr 26 17:43:24 2012
@@ -652,6 +652,7 @@
     //   end of the template-parameter-list rather than a greater-than
     //   operator.
     GreaterThanIsOperatorScope G(GreaterThanIsOperator, false);
+    EnterExpressionEvaluationContext Unevaluated(Actions, Sema::Unevaluated);
 
     DefaultArg = ParseAssignmentExpression();
     if (DefaultArg.isInvalid())

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=155670&r1=155669&r2=155670&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Thu Apr 26 17:43:24 2012
@@ -2562,6 +2562,7 @@
                                    SourceRange(TemplateLoc, RAngleLoc));
 
   Sema::ContextRAII SavedContext(SemaRef, Template->getDeclContext());
+  EnterExpressionEvaluationContext Unevaluated(SemaRef, Sema::Unevaluated);
   return SemaRef.SubstExpr(Param->getDefaultArgument(), AllTemplateArgs);
 }
 

Modified: cfe/trunk/test/SemaTemplate/default-expr-arguments.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/default-expr-arguments.cpp?rev=155670&r1=155669&r2=155670&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/default-expr-arguments.cpp (original)
+++ cfe/trunk/test/SemaTemplate/default-expr-arguments.cpp Thu Apr 26 17:43:24 2012
@@ -292,3 +292,14 @@
     f();
   }
 }
+
+namespace PR12581 {
+  const int a = 0;
+  template < typename > struct A;
+  template < typename MatrixType, int =
+  A < MatrixType >::Flags ? : A < MatrixType >::Flags & a > class B;
+  void
+  fn1 ()
+  {
+  }
+}





More information about the cfe-commits mailing list