[PATCH] Generic Lambdas: The next step

Faisal Vali faisalv at yahoo.com
Sun Sep 15 20:37:59 PDT 2013


  - fixed capturing of 'this' so that if namelookup finds
    an unresolvable non-static member function and the lambda can capture, it must captures 'this'.  It obviously captures if the call is resolved to a non-static member.

    template<class T>
    struct X {
     static void f(double);
     void f(int);
     double (*fd)(double) = [](auto a) { f(a); return a; };
    };

  - diagnose capture errors in generic lambdas early for variables that clearly will be odr-used within the lambda - do not wait for the call operator to be specialized.
  auto L = [](auto a) {
       return [](auto b) {
         return a; // emit an error, don't wait for instantiation.
       };
  };


  Thanks!

Hi rsmith, doug.gregor, eli.friedman,

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

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D1174?vs=4136&id=4311#toc

Files:
  include/clang/AST/ASTContext.h
  include/clang/AST/ASTLambda.h
  include/clang/AST/DeclCXX.h
  include/clang/AST/ExprCXX.h
  include/clang/AST/Type.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/DeclSpec.h
  include/clang/Sema/ScopeInfo.h
  include/clang/Sema/Sema.h
  include/clang/Sema/SemaLambda.h
  lib/AST/ASTContext.cpp
  lib/AST/ASTImporter.cpp
  lib/AST/Decl.cpp
  lib/AST/DeclCXX.cpp
  lib/AST/ExprCXX.cpp
  lib/AST/Type.cpp
  lib/CodeGen/CGClass.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseExprCXX.cpp
  lib/Parse/Parser.cpp
  lib/Parse/ParseTemplate.cpp
  lib/Sema/Sema.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaExprMember.cpp
  lib/Sema/SemaLambda.cpp
  lib/Sema/SemaOverload.cpp
  lib/Sema/SemaStmt.cpp
  lib/Sema/SemaTemplateDeduction.cpp
  lib/Sema/SemaTemplateInstantiate.cpp
  lib/Sema/SemaTemplateInstantiateDecl.cpp
  lib/Sema/SemaType.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReader.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriter.cpp
  test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3-generic-lambda-1y.cpp
  test/CXX/expr/expr.prim/expr.prim.lambda/generic-lambda-capturing.cpp
  test/CXX/expr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp
  test/CXX/expr/expr.prim/expr.prim.lambda/p4-1y.cpp
  test/CXX/expr/expr.prim/expr.prim.lambda/p4.cpp
  test/CXX/expr/expr.prim/expr.prim.lambda/p5-generic-lambda-1y.cpp
  test/Parser/DelayedTemplateParsing.cpp
  test/PCH/cxx1y-lambdas.mm
  test/SemaCXX/cxx1y-deduced-return-type.cpp
  test/SemaCXX/cxx1y-generic-lambdas.cpp
  test/SemaCXX/lambda-expressions.cpp
  test/SemaTemplate/ms-function-specialization-class-scope.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1174.6.patch
Type: text/x-patch
Size: 241892 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130915/7a8c9835/attachment.bin>


More information about the cfe-commits mailing list