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

Douglas Gregor dgregor at apple.com
Mon Apr 30 11:26:27 PDT 2012


Joerg, the protocol here is to ask me and CC Bill, because only a code owner can approve changes to the branch.

Approved.

	- Doug

On Apr 28, 2012, at 9:18 AM, Joerg Sonnenberger wrote:

> Bill, please pull this onto the 3.1 branch.
> 
> Joerg
> 
> On Thu, Apr 26, 2012 at 10:43:24PM -0000, Eli Friedman wrote:
>> 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 ()
>> +  {
>> +  }
>> +}
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list