<div dir="ltr">I forgot the () in the lambda definition, this should be:<div><br></div><div>  ..</div><div>  <span style="font-size:12.8px">auto l = [this] { auto l = []() EXCLUSIVE_LOCKS_REQUIRED(mu_) {}; };</span></div><div><span style="font-size:12.8px">  ..</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Doesn't change the fact that clang segfaults without this revert, though.</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 2, 2017 at 2:38 PM, Daniel Jasper via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: djasper<br>
Date: Tue May  2 07:38:27 2017<br>
New Revision: 301916<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=301916&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=301916&view=rev</a><br>
Log:<br>
Revert r301735 (and subsequent r301786).<br>
<br>
It leads to clang crashing, e.g. on this short code fragment (added to<br>
test/SemaCXX/warn-thread-<wbr>safety-parsing.cpp):<br>
<br>
  class SomeClass {<br>
  public:<br>
    void foo() {<br>
      auto l = [this] { auto l = [] EXCLUSIVE_LOCKS_REQUIRED(mu_) {}; };<br>
    }<br>
    Mutex mu_;<br>
  };<br>
<br>
Modified:<br>
    cfe/trunk/lib/Sema/<wbr>SemaExprCXX.cpp<br>
    cfe/trunk/test/SemaCXX/cxx1z-<wbr>lambda-star-this.cpp<br>
<br>
Modified: cfe/trunk/lib/Sema/<wbr>SemaExprCXX.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=301916&r1=301915&r2=301916&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>SemaExprCXX.cpp?rev=301916&r1=<wbr>301915&r2=301916&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/<wbr>SemaExprCXX.cpp (original)<br>
+++ cfe/trunk/lib/Sema/<wbr>SemaExprCXX.cpp Tue May  2 07:38:27 2017<br>
@@ -901,35 +901,17 @@ static QualType adjustCVQualifiersForCXX<br>
   // capturing lamdbda's call operator.<br>
   //<br>
<br>
-  // Since the FunctionScopeInfo stack is representative of the lexical<br>
-  // nesting of the lambda expressions during initial parsing (and is the best<br>
-  // place for querying information about captures about lambdas that are<br>
-  // partially processed) and perhaps during instantiation of function templates<br>
-  // that contain lambda expressions that need to be transformed BUT not<br>
-  // necessarily during instantiation of a nested generic lambda's function call<br>
-  // operator (which might even be instantiated at the end of the TU) - at which<br>
-  // time the DeclContext tree is mature enough to query capture information<br>
-  // reliably - we use a two pronged approach to walk through all the lexically<br>
-  // enclosing lambda expressions:<br>
-  //<br>
-  //  1) Climb down the FunctionScopeInfo stack as long as each item represents<br>
-  //  a Lambda (i.e. LambdaScopeInfo) AND each LSI's 'closure-type' is lexically<br>
-  //  enclosed by the call-operator of the LSI below it on the stack (while<br>
-  //  tracking the enclosing DC for step 2 if needed).  Note the topmost LSI on<br>
-  //  the stack represents the innermost lambda.<br>
-  //<br>
-  //  2) Iterate out through the DeclContext chain (if it represents a lambda's<br>
-  //  call operator, and therefore must be a generic lambda's call operator,<br>
-  //  which is the only time an inconsistency between the LSI and the<br>
-  //  DeclContext should occur) querying closure types regarding capture<br>
-  //  information.<br>
+  // The issue is that we cannot rely entirely on the FunctionScopeInfo stack<br>
+  // since ScopeInfos are pushed on during parsing and treetransforming. But<br>
+  // since a generic lambda's call operator can be instantiated anywhere (even<br>
+  // end of the TU) we need to be able to examine its enclosing lambdas and so<br>
+  // we use the DeclContext to get a hold of the closure-class and query it for<br>
+  // capture information.  The reason we don't just resort to always using the<br>
+  // DeclContext chain is that it is only mature for lambda expressions<br>
+  // enclosing generic lambda's call operators that are being instantiated.<br>
<br>
-<br>
-  // 1) Climb down the function scope info stack.<br>
   for (int I = FunctionScopes.size();<br>
-       I-- && isa<LambdaScopeInfo>(<wbr>FunctionScopes[I]) &&<br>
-       (!CurLSI || CurLSI->Lambda-><wbr>getDeclContext() ==<br>
-                       cast<LambdaScopeInfo>(<wbr>FunctionScopes[I])-><wbr>CallOperator);<br>
+       I-- && isa<LambdaScopeInfo>(<wbr>FunctionScopes[I]);<br>
        CurDC = getLambdaAwareParentOfDeclCont<wbr>ext(CurDC)) {<br>
     CurLSI = cast<LambdaScopeInfo>(<wbr>FunctionScopes[I]);<br>
<br>
@@ -945,17 +927,11 @@ static QualType adjustCVQualifiersForCXX<br>
       return ASTCtx.getPointerType(<wbr>ClassType);<br>
     }<br>
   }<br>
-<br>
-  // 2) We've run out of ScopeInfos but check if CurDC is a lambda (which can<br>
-  // happen during instantiation of its nested generic lambda call operator)<br>
+  // We've run out of ScopeInfos but check if CurDC is a lambda (which can<br>
+  // happen during instantiation of generic lambdas)<br>
   if (isLambdaCallOperator(CurDC)) {<br>
-    assert(CurLSI && "While computing 'this' capture-type for a generic "<br>
-                     "lambda, we must have a corresponding LambdaScopeInfo");<br>
-    assert(<wbr>isGenericLambdaCallOperatorSpe<wbr>cialization(CurLSI-><wbr>CallOperator) &&<br>
-           "While computing 'this' capture-type for a generic lambda, when we "<br>
-           "run out of enclosing LSI's, yet the enclosing DC is a "<br>
-           "lambda-call-operator we must be (i.e. Current LSI) in a generic "<br>
-           "lambda call oeprator");<br>
+    assert(CurLSI);<br>
+    assert(<wbr>isGenericLambdaCallOperatorSpe<wbr>cialization(CurLSI-><wbr>CallOperator));<br>
     assert(CurDC == getLambdaAwareParentOfDeclCont<wbr>ext(CurLSI->CallOperator));<br>
<br>
     auto IsThisCaptured =<br>
<br>
Modified: cfe/trunk/test/SemaCXX/cxx1z-<wbr>lambda-star-this.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx1z-lambda-star-this.cpp?rev=301916&r1=301915&r2=301916&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/<wbr>SemaCXX/cxx1z-lambda-star-<wbr>this.cpp?rev=301916&r1=301915&<wbr>r2=301916&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/SemaCXX/cxx1z-<wbr>lambda-star-this.cpp (original)<br>
+++ cfe/trunk/test/SemaCXX/cxx1z-<wbr>lambda-star-this.cpp Tue May  2 07:38:27 2017<br>
@@ -1,293 +1,231 @@<br>
-// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -emit-llvm-only %s<br>
-// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fdelayed-template-parsing %s -DDELAYED_TEMPLATE_PARSING<br>
-// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fms-extensions %s -DMS_EXTENSIONS<br>
-// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fdelayed-template-parsing -fms-extensions %s -DMS_EXTENSIONS -DDELAYED_TEMPLATE_PARSING<br>
-<br>
-template <class, class><br>
-constexpr bool is_same = false;<br>
-template <class T><br>
-constexpr bool is_same<T, T> = true;<br>
-<br>
-namespace test_star_this {<br>
-namespace ns1 {<br>
-class A {<br>
-  int x = 345;<br>
-  auto foo() {<br>
-    (void)[ *this, this ]{}; //expected-error{{'this' can appear only once}}<br>
-    (void)[this] { ++x; };<br>
-    (void)[*this] { ++x; }; //expected-error{{read-only variable}}<br>
-    (void)[*this]() mutable { ++x; };<br>
-    (void)[=] { return x; };<br>
-    (void)[&, this ] { return x; };<br>
-    (void)[ =, *this ] { return x; };<br>
-    (void)[&, *this ] { return x; };<br>
-  }<br>
-};<br>
-} // namespace ns1<br>
-<br>
-namespace ns2 {<br>
-class B {<br>
-  B(const B &) = delete; //expected-note{{deleted here}}<br>
-  int *x = (int *)456;<br>
-  void foo() {<br>
-    (void)[this] { return x; };<br>
-    (void)[*this] { return x; }; //expected-error{{call to deleted}}<br>
-  }<br>
-};<br>
-} // namespace ns2<br>
-<br>
-namespace ns3 {<br>
-class B {<br>
-  B(const B &) = delete; //expected-note2{{deleted here}}<br>
-<br>
-  int *x = (int *)456;<br>
-<br>
-public:<br>
-  template <class T = int><br>
-  void foo() {<br>
-    (void)[this] { return x; };<br>
-    (void)[*this] { return x; }; //expected-error2{{call to deleted}}<br>
-  }<br>
-<br>
-  B() = default;<br>
-} b;<br>
-B *c = (b.foo(), nullptr); //expected-note{{in instantiation}}<br>
-} // namespace ns3<br>
-<br>
-namespace ns4 {<br>
-template <class U><br>
-class B {<br>
-  B(const B &) = delete; //expected-note{{deleted here}}<br>
-  double d = 3.14;<br>
-<br>
-public:<br>
-  template <class T = int><br>
-  auto foo() {<br>
-    const auto &L = [*this](auto a) mutable { //expected-error{{call to deleted}}<br>
-      d += a;<br>
-      return [this](auto b) { return d += b; };<br>
-    };<br>
-  }<br>
-<br>
-  B() = default;<br>
-};<br>
-void main() {<br>
-  B<int *> b;<br>
-  b.foo(); //expected-note{{in instantiation}}<br>
-} // end main<br>
-} // namespace ns4<br>
-<br>
-namespace ns5 {<br>
-<br>
-struct X {<br>
-  double d = 3.14;<br>
-  X(const volatile X &);<br>
-  void foo() {<br>
-  }<br>
-<br>
-  void foo() const { //expected-note{{const}}<br>
-<br>
-    auto L = [*this]() mutable {<br>
-      static_assert(is_same<<wbr>decltype(this), X *>);<br>
-      ++d;<br>
-      auto M = [this] {<br>
-        static_assert(is_same<<wbr>decltype(this), X *>);<br>
-        ++d;<br>
-        auto N = [] {<br>
-          static_assert(is_same<<wbr>decltype(this), X *>);<br>
-        };<br>
-      };<br>
-    };<br>
-<br>
-    auto L1 = [*this] {<br>
-      static_assert(is_same<<wbr>decltype(this), const X *>);<br>
-      auto M = [this]() mutable {<br>
-        static_assert(is_same<<wbr>decltype(this), const X *>);<br>
-        auto N = [] {<br>
-          static_assert(is_same<<wbr>decltype(this), const X *>);<br>
-        };<br>
-      };<br>
-      auto M2 = [*this]() mutable {<br>
-        static_assert(is_same<<wbr>decltype(this), X *>);<br>
-        auto N = [] {<br>
-          static_assert(is_same<<wbr>decltype(this), X *>);<br>
-        };<br>
-      };<br>
-    };<br>
-<br>
-    auto GL1 = [*this](auto a) {<br>
-      static_assert(is_same<<wbr>decltype(this), const X *>);<br>
-      auto M = [this](auto b) mutable {<br>
-        static_assert(is_same<<wbr>decltype(this), const X *>);<br>
-        auto N = [](auto c) {<br>
-          static_assert(is_same<<wbr>decltype(this), const X *>);<br>
-        };<br>
-        return N;<br>
-      };<br>
-<br>
-      auto M2 = [*this](auto a) mutable {<br>
-        static_assert(is_same<<wbr>decltype(this), X *>);<br>
-        auto N = [](auto b) {<br>
-          static_assert(is_same<<wbr>decltype(this), X *>);<br>
-        };<br>
-        return N;<br>
-      };<br>
-      return [=](auto a) mutable { M(a)(a); M2(a)(a); };<br>
-    };<br>
-<br>
-    GL1("abc")<br>
-    ("abc");<br>
-<br>
-    auto L2 = [this]() mutable {<br>
-      static_assert(is_same<<wbr>decltype(this), const X *>);<br>
-      ++d; //expected-error{{cannot assign}}<br>
-    };<br>
-    auto GL = [*this](auto a) mutable {<br>
-      static_assert(is_same<<wbr>decltype(this), X *>);<br>
-      ++d;<br>
-      auto M = [this](auto b) {<br>
-        static_assert(is_same<<wbr>decltype(this), X *>);<br>
-        ++d;<br>
-        auto N = [](auto c) {<br>
-          static_assert(is_same<<wbr>decltype(this), X *>);<br>
-        };<br>
-        N(3.14);<br>
-      };<br>
-      M("abc");<br>
-    };<br>
-    GL(3.14);<br>
-  }<br>
-  void foo() volatile const {<br>
-    auto L = [this]() {<br>
-      static_assert(is_same<<wbr>decltype(this), const volatile X *>);<br>
-      auto M = [*this]() mutable {<br>
-        static_assert(is_same<<wbr>decltype(this), X *>);<br>
-        auto N = [this] {<br>
-          static_assert(is_same<<wbr>decltype(this), X *>);<br>
-          auto M = [] {<br>
-            static_assert(is_same<<wbr>decltype(this), X *>);<br>
-          };<br>
-        };<br>
-        auto N2 = [*this] {<br>
-          static_assert(is_same<<wbr>decltype(this), const X *>);<br>
-        };<br>
-      };<br>
-      auto M2 = [*this]() {<br>
-        static_assert(is_same<<wbr>decltype(this), const X *>);<br>
-        auto N = [this] {<br>
-          static_assert(is_same<<wbr>decltype(this), const X *>);<br>
-        };<br>
-      };<br>
-    };<br>
-  }<br>
-};<br>
-<br>
-} // namespace ns5<br>
-namespace ns6 {<br>
-struct X {<br>
-  double d;<br>
-  auto foo() const {<br>
-    auto L = [*this]() mutable {<br>
-      auto M = [=](auto a) {<br>
-        auto N = [this] {<br>
-          ++d;<br>
-          static_assert(is_same<<wbr>decltype(this), X *>);<br>
-          auto O = [*this] {<br>
-            static_assert(is_same<<wbr>decltype(this), const X *>);<br>
-          };<br>
-        };<br>
-        N();<br>
-        static_assert(is_same<<wbr>decltype(this), X *>);<br>
-      };<br>
-      return M;<br>
-    };<br>
-    return L;<br>
-  }<br>
-};<br>
-<br>
-int main() {<br>
-  auto L = X{}.foo();<br>
-  auto M = L();<br>
-  M(3.14);<br>
-}<br>
-} // namespace ns6<br>
-namespace ns7 {<br>
-<br>
-struct X {<br>
-  double d;<br>
-  X();<br>
-  X(const X &);<br>
-  X(X &) = delete;<br>
-  auto foo() const {<br>
-    //OK - the object used to initialize our capture is a const object and so prefers the non-deleted ctor.<br>
-    const auto &&L = [*this]{};<br>
-  }<br>
-};<br>
-int main() {<br>
-  X x;<br>
-  x.foo();<br>
-}<br>
-} // namespace ns7<br>
-<br>
-} // namespace test_star_this<br>
-<br>
-namespace PR32831 {<br>
-// <a href="https://bugs.llvm.org/show_bug.cgi?id=32831" rel="noreferrer" target="_blank">https://bugs.llvm.org/show_<wbr>bug.cgi?id=32831</a><br>
-namespace ns1 {<br>
-template <typename Func><br>
-void fun_template(Func func) {<br>
-  (void)[&]() {<br>
-    func(0);<br>
-  };<br>
-}<br>
-<br>
-class A {<br>
-  void member_foo() {<br>
-    (void)[this] {<br>
-      (void)[this] {<br>
-        fun_template(<br>
-            [this](auto X) {<br>
-              auto L = [this](auto Y) { member_foo(); };<br>
-              L(5);<br>
-            });<br>
-        fun_template(<br>
-            [this](auto) { member_foo(); });<br>
-      };<br>
-    };<br>
-  }<br>
-};<br>
-} // namespace ns1<br>
-<br>
-namespace ns2 {<br>
-<br>
-struct B {<br>
-  int data = 0;<br>
-  template <class F><br>
-  void mem2(F f) {<br>
-    (void)[&](auto f) {<br>
-      (void)[&] { f(this->data); };<br>
-    }<br>
-    (f);<br>
-  }<br>
-};<br>
-<br>
-class A {<br>
-  void member_foo() {<br>
-    (void)[this] {<br>
-      (void)[this] {<br>
-        B{}.mem2(<br>
-            [this](auto X) {<br>
-              auto L = [this](auto Y) { member_foo(); };<br>
-              L(5);<br>
-            });<br>
-        B{}.mem2(<br>
-            [this](auto) { member_foo(); });<br>
-      };<br>
-    };<br>
-  }<br>
-};<br>
-<br>
-} // namespace ns2<br>
-<br>
-} // namespace PR32831<br>
-<br>
+// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -emit-llvm-only %s<br>
+// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fdelayed-template-parsing %s -DDELAYED_TEMPLATE_PARSING<br>
+// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fms-extensions %s -DMS_EXTENSIONS<br>
+// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fdelayed-template-parsing -fms-extensions %s -DMS_EXTENSIONS -DDELAYED_TEMPLATE_PARSING<br>
+<br>
+template<class, class> constexpr bool is_same = false;<br>
+template<class T> constexpr bool is_same<T, T> = true;<br>
+<br>
+namespace test_star_this {<br>
+namespace ns1 {<br>
+class A {<br>
+  int x = 345;<br>
+  auto foo() {<br>
+    (void) [*this, this] { };  //expected-error{{'this' can appear only once}}<br>
+    (void) [this] { ++x; };<br>
+    (void) [*this] { ++x; };  //expected-error{{read-only variable}}<br>
+    (void) [*this] () mutable { ++x; };<br>
+    (void) [=] { return x; };<br>
+    (void) [&, this] { return x; };<br>
+    (void) [=, *this] { return x; };<br>
+    (void) [&, *this] { return x; };<br>
+  }<br>
+};<br>
+} // end ns1<br>
+<br>
+namespace ns2 {<br>
+  class B {<br>
+    B(const B&) = delete; //expected-note{{deleted here}}<br>
+    int *x = (int *) 456;<br>
+    void foo() {<br>
+      (void)[this] { return x; };<br>
+      (void)[*this] { return x; }; //expected-error{{call to deleted}}<br>
+    }<br>
+  };<br>
+} // end ns2<br>
+namespace ns3 {<br>
+  class B {<br>
+    B(const B&) = delete; //expected-note2{{deleted here}}<br>
+<br>
+    int *x = (int *) 456;<br>
+    public:<br>
+    template<class T = int><br>
+    void foo() {<br>
+      (void)[this] { return x; };<br>
+      (void)[*this] { return x; }; //expected-error2{{call to deleted}}<br>
+    }<br>
+<br>
+    B() = default;<br>
+  } b;<br>
+  B *c = (b.foo(), nullptr); //expected-note{{in instantiation}}<br>
+} // end ns3<br>
+<br>
+namespace ns4 {<br>
+template<class U><br>
+class B {<br>
+  B(const B&) = delete; //expected-note{{deleted here}}<br>
+  double d = 3.14;<br>
+  public:<br>
+  template<class T = int><br>
+  auto foo() {<br>
+    const auto &L = [*this] (auto a) mutable { //expected-error{{call to deleted}}<br>
+      d += a;<br>
+      return [this] (auto b) { return d +=b; };<br>
+    };<br>
+  }<br>
+<br>
+  B() = default;<br>
+};<br>
+void main() {<br>
+  B<int*> b;<br>
+  b.foo(); //expected-note{{in instantiation}}<br>
+} // end main<br>
+} // end ns4<br>
+namespace ns5 {<br>
+<br>
+struct X {<br>
+  double d = 3.14;<br>
+  X(const volatile X&);<br>
+  void foo() {<br>
+<br>
+  }<br>
+<br>
+  void foo() const { //expected-note{{const}}<br>
+<br>
+    auto L = [*this] () mutable {<br>
+      static_assert(is_same<<wbr>decltype(this), X*>);<br>
+      ++d;<br>
+      auto M = [this] {<br>
+        static_assert(is_same<<wbr>decltype(this), X*>);<br>
+        ++d;<br>
+        auto N = [] {<br>
+          static_assert(is_same<<wbr>decltype(this), X*>);<br>
+        };<br>
+      };<br>
+    };<br>
+<br>
+    auto L1 = [*this] {<br>
+      static_assert(is_same<<wbr>decltype(this), const X*>);<br>
+      auto M = [this] () mutable {<br>
+        static_assert(is_same<<wbr>decltype(this), const X*>);<br>
+        auto N = [] {<br>
+          static_assert(is_same<<wbr>decltype(this), const X*>);<br>
+        };<br>
+      };<br>
+      auto M2 = [*this] () mutable {<br>
+        static_assert(is_same<<wbr>decltype(this), X*>);<br>
+        auto N = [] {<br>
+          static_assert(is_same<<wbr>decltype(this), X*>);<br>
+        };<br>
+      };<br>
+    };<br>
+<br>
+    auto GL1 = [*this] (auto a) {<br>
+      static_assert(is_same<<wbr>decltype(this), const X*>);<br>
+      auto M = [this] (auto b) mutable {<br>
+        static_assert(is_same<<wbr>decltype(this), const X*>);<br>
+        auto N = [] (auto c) {<br>
+          static_assert(is_same<<wbr>decltype(this), const X*>);<br>
+        };<br>
+        return N;<br>
+      };<br>
+<br>
+      auto M2 = [*this] (auto a) mutable {<br>
+        static_assert(is_same<<wbr>decltype(this), X*>);<br>
+        auto N = [] (auto b) {<br>
+          static_assert(is_same<<wbr>decltype(this), X*>);<br>
+        };<br>
+        return N;<br>
+      };<br>
+      return [=](auto a) mutable { M(a)(a); M2(a)(a); };<br>
+    };<br>
+<br>
+    GL1("abc")("abc");<br>
+<br>
+<br>
+    auto L2 = [this] () mutable {<br>
+      static_assert(is_same<<wbr>decltype(this), const X*>);<br>
+      ++d; //expected-error{{cannot assign}}<br>
+    };<br>
+    auto GL = [*this] (auto a) mutable {<br>
+      static_assert(is_same<<wbr>decltype(this), X*>);<br>
+      ++d;<br>
+      auto M = [this] (auto b) {<br>
+        static_assert(is_same<<wbr>decltype(this), X*>);<br>
+        ++d;<br>
+        auto N = [] (auto c) {<br>
+          static_assert(is_same<<wbr>decltype(this), X*>);<br>
+        };<br>
+        N(3.14);<br>
+      };<br>
+      M("abc");<br>
+    };<br>
+    GL(3.14);<br>
+<br>
+  }<br>
+  void foo() volatile const {<br>
+    auto L = [this] () {<br>
+      static_assert(is_same<<wbr>decltype(this), const volatile X*>);<br>
+      auto M = [*this] () mutable {<br>
+        static_assert(is_same<<wbr>decltype(this), X*>);<br>
+        auto N = [this] {<br>
+          static_assert(is_same<<wbr>decltype(this), X*>);<br>
+          auto M = [] {<br>
+            static_assert(is_same<<wbr>decltype(this), X*>);<br>
+          };<br>
+        };<br>
+        auto N2 = [*this] {<br>
+          static_assert(is_same<<wbr>decltype(this), const X*>);<br>
+        };<br>
+      };<br>
+      auto M2 = [*this] () {<br>
+        static_assert(is_same<<wbr>decltype(this), const X*>);<br>
+        auto N = [this] {<br>
+          static_assert(is_same<<wbr>decltype(this), const X*>);<br>
+        };<br>
+      };<br>
+    };<br>
+  }<br>
+<br>
+};<br>
+<br>
+} //end ns5<br>
+namespace ns6 {<br>
+struct X {<br>
+  double d;<br>
+  auto foo() const {<br>
+    auto L = [*this] () mutable {<br>
+      auto M = [=] (auto a) {<br>
+        auto N = [this] {<br>
+          ++d;<br>
+          static_assert(is_same<<wbr>decltype(this), X*>);<br>
+          auto O = [*this] {<br>
+            static_assert(is_same<<wbr>decltype(this), const X*>);<br>
+          };<br>
+        };<br>
+        N();<br>
+        static_assert(is_same<<wbr>decltype(this), X*>);<br>
+      };<br>
+      return M;<br>
+    };<br>
+    return L;<br>
+  }<br>
+};<br>
+<br>
+int main() {<br>
+  auto L = X{}.foo();<br>
+  auto M = L();<br>
+  M(3.14);<br>
+}<br>
+} // end ns6<br>
+namespace ns7 {<br>
+<br>
+struct X {<br>
+  double d;<br>
+  X();<br>
+  X(const X&);<br>
+  X(X&) = delete;<br>
+  auto foo() const {<br>
+    //OK - the object used to initialize our capture is a const object and so prefers the non-deleted ctor.<br>
+    const auto &&L = [*this] { };<br>
+  }<br>
+<br>
+};<br>
+int main() {<br>
+  X x;<br>
+  x.foo();<br>
+}<br>
+} // end ns7<br>
+<br>
+} //end ns test_star_this<br>
+<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>