[PATCH] D11006: Classes inside lambdas are local not nested.

Serge Pavlov sepavloff at gmail.com
Wed Jul 8 00:51:56 PDT 2015


================
Comment at: lib/Parse/ParseDeclCXX.cpp:2822-2829
@@ -2821,7 +2821,10 @@
         // nested class.
         const Scope *Parent = S->getParent();
         if (Parent->isTemplateParamScope())
           Parent = Parent->getParent();
         if (Parent->isClassScope())
           break;
+        // Classes defined inside lambda functions are local as well.
+        if (S->getFlags() & Scope::BlockScope)
+          break;
       }
----------------
rsmith wrote:
> Do we need to check the parent scope here at all? (Why can't we just break immediately once we reach a function scope?)
I cannot invent a case where this check would require inspection of parent. Will remove it.


http://reviews.llvm.org/D11006







More information about the cfe-commits mailing list