[PATCH] Implement transformations of non-capturing nested lambdas.

Faisal Vali faisalv at yahoo.com
Sun Sep 29 21:14:33 PDT 2013


Hi doug.gregor, rsmith, eli.friedman, jdennett,

This patch teaches TreeTransform how to transform generic lambdas.  It does not include capturing.

I have a question in the patch that I would appreciate some clarity on.

Please see test file for reasonably extensive examples such as:

<code>

auto L = [](auto ... a) { 
      auto M = [](decltype(a) ... b) {  
        auto N = [](auto c) -> void {
          int x = 0;
          x = sizeof...(a);        
          x = sizeof...(b);
          x = sizeof(c);
        };  
        N('a');
        N(N);
        N(FirstType<Ts...>{});
        return N;
      };
      M(a...);
      return M;
    };
    auto M = L(L, ts...);
    decltype(L(L, ts...)) (*fp)(decltype(L), decltype(ts) ...) = L;
    fp(L, ts...);
    decltype(L(L, ts...)(L, ts...)) (*fp2)(decltype(L), decltype(ts) ...) = L(L, ts...);
    fp2 = fp(L, ts...);
    void (*fp3)(char) = fp2(L, ts...);
    fp3('a');

</code>


http://llvm-reviews.chandlerc.com/D1784

Files:
  lib/Sema/SemaTemplateInstantiate.cpp
  lib/Sema/SemaTemplateInstantiateDecl.cpp
  lib/Sema/TreeTransform.h
  test/SemaCXX/cxx1y-generic-lambdas.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1784.1.patch
Type: text/x-patch
Size: 24355 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130929/b6e09860/attachment.bin>


More information about the cfe-commits mailing list