[PATCH] D19175: Fix for PR27015 (variable template initialized with a generic lambda expression)

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 27 17:42:39 PDT 2016


rsmith added inline comments.

================
Comment at: lib/Parse/ParseTemplate.cpp:151-153
@@ -149,1 +150,5 @@
 
+  if (isSpecialization)
+    TemplateParmScopePtr->setFlags(TemplateParmScopePtr->getFlags() ^
+                                   Scope::TemplateParamScope);
+
----------------
Use `ParseScopeFlags` to change the flags here rather than calling `setFlags` directly. Please also use `getFlags() & ~Scope::TemplateParamScope` rather than `^` to make it more obvious that you're clearing the flag not just flipping it.

================
Comment at: lib/Sema/SemaLambda.cpp:818
@@ -817,3 +817,3 @@
   if (Scope *TmplScope = CurScope->getTemplateParamParent())
-    if (!TmplScope->decl_empty())
+    if (TmplScope->isTemplateParamScope())
       KnownDependent = true;
----------------
This should not be necessary. It looks like `Scope::setFlags` fails to update `TemplateParamParent` (etc) if the relevant flag changes. Instead of adding this `if`, try changing the body of `Scope::setFlags` to call `Init(AnyParent, F);`.


http://reviews.llvm.org/D19175





More information about the cfe-commits mailing list