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

Richard Smith richard at metafoo.co.uk
Tue Jul 7 12:55:50 PDT 2015


rsmith added a subscriber: rsmith.

================
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;
       }
----------------
Do we need to check the parent scope here at all? (Why can't we just break immediately once we reach a function scope?)


http://reviews.llvm.org/D11006







More information about the cfe-commits mailing list