erichkeane added inline comments.

================
Comment at: clang/lib/Parse/ParseExprCXX.cpp:1283
 
   ParseScope LambdaScope(this, Scope::LambdaScope | Scope::DeclScope |
                                    Scope::FunctionDeclarationScope |
----------------
Ok, last bit, I promise :)  I see that we set up the lambda scope here and push 
the lambda scope on 1287.  Instead of passing a bool, could we just figure out 
the `IsLambdaRequiresClause` based on that instead?  See definition of 
`PushLambdaScope` here: 
https://clang.llvm.org/doxygen/Sema_8cpp_source.html#l02141

A test to see if that would work would be the one you have below, PLUS an 
example of a requires clause INSIDE of a lambda that itself isn't a lambda that 
would reproduce the warning(though I'm not convinced ATM that is possible, I 
don't think we allow a template inside block scope, unless there is some trick 
I'm too uncreative enough to come up with).  If none exists, just checking the 
current scope would work and perhaps be more preferential.  

We do this rarely, but we do it at least in SemaStmt.cpp in 
ActOnCapScopeReturnStmt.  Just a `dyn_cast<LambdaScopeInfo>(getCurFunction())` 
might be able to replace the bool all over the place.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146140/new/

https://reviews.llvm.org/D146140

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to