<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 14, 2012, at 10:52 AM, Douglas Gregor wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Chad,<div><br><div><div>On Feb 14, 2012, at 10:48 AM, Chad Rosier <<a href="mailto:mcrosier@apple.com">mcrosier@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Doug,<div>The test you added seems to be failing on the clang-x86_64-darwin10-gcc42-RA buildbot.</div></div></blockquote><div><br></div>Should be fixed in r150493.</div></div></div></blockquote><div><br></div>Thanks, Doug!</div><div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">   </span>- Doug</div><div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>See:</div><div><a href="http://smooshlab.apple.com:8013/builders/clang-x86_64-darwin10-gcc42-RA/builds/11800">http://smooshlab.apple.com:8013/builders/clang-x86_64-darwin10-gcc42-RA/builds/11800</a></div><div><br></div><div>Complete error message below:</div><div><span class="Apple-style-span" style="font-family: Times; "><pre style="font-family: 'Courier New', courier, monotype; "><span class="stdout" style="font-family: 'Courier New', courier, monotype; color: black; ">******************** TEST 'Clang :: PCH/cxx11-lambdas.cpp' FAILED ********************Script:
--
/Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/Release+Asserts/bin/clang -cc1 -internal-isystem /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/Release+Asserts/bin/../lib/clang/3.1/include -pedantic-errors -std=c++11 -emit-pch /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang.src/test/PCH/cxx11-lambdas.cpp -o /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/tools/clang/test/PCH/Output/cxx11-lambdas.cpp.tmp-cxx11
/Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/Release+Asserts/bin/clang -cc1 -internal-isystem /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/Release+Asserts/bin/../lib/clang/3.1/include -ast-print -pedantic-errors -std=c++11 -include-pch /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/tools/clang/test/PCH/Output/cxx11-lambdas.cpp.tmp-cxx11  /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang.src/test/PCH/cxx11-lambdas.cpp | FileCheck -check-prefix=CHECK-PRINT /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang.src/test/PCH/cxx11-lambdas.cpp
--
Exit Code: 1
Command Output (stderr):
--
/Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang.src/test/PCH/cxx11-lambdas.cpp:35:17: error: expected string not found in input
// CHECK-PRINT: int add_slowly
                ^
<stdin>:16:17: note: scanning from here
 return [=, &y] {
                ^
<stdin>:31:6: note: possible intended match here
 int i = add_slowly(x, y);
     ^
--

********************</span></pre></span><div> Chad<span class="Apple-style-span" style="font-family: Times; "></span></div><div><br></div><div><br></div><div><div>On Feb 14, 2012, at 9:54 AM, Douglas Gregor wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Author: dgregor<br>Date: Tue Feb 14 11:54:36 2012<br>New Revision: 150491<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=150491&view=rev">http://llvm.org/viewvc/llvm-project?rev=150491&view=rev</a><br>Log:<br>Implement AST (de-)serialization for lambda expressions.<br><br>Added:<br>    cfe/trunk/test/PCH/cxx11-lambdas.cpp   (with props)<br>Modified:<br>    cfe/trunk/include/clang/AST/ExprCXX.h<br>    cfe/trunk/include/clang/Serialization/ASTBitCodes.h<br>    cfe/trunk/lib/AST/ExprCXX.cpp<br>    cfe/trunk/lib/Serialization/ASTReaderDecl.cpp<br>    cfe/trunk/lib/Serialization/ASTReaderStmt.cpp<br>    cfe/trunk/lib/Serialization/ASTWriter.cpp<br>    cfe/trunk/lib/Serialization/ASTWriterStmt.cpp<br><br>Modified: cfe/trunk/include/clang/AST/ExprCXX.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=150491&r1=150490&r2=150491&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=150491&r1=150490&r2=150491&view=diff</a><br>==============================================================================<br>--- cfe/trunk/include/clang/AST/ExprCXX.h (original)<br>+++ cfe/trunk/include/clang/AST/ExprCXX.h Tue Feb 14 11:54:36 2012<br>@@ -1168,6 +1168,14 @@<br>              ArrayRef<unsigned> ArrayIndexStarts,<br>              SourceLocation ClosingBrace);<br><br>+  /// \brief Construct an empty lambda expression.<br>+  LambdaExpr(EmptyShell Empty, unsigned NumCaptures, bool HasArrayIndexVars)<br>+    : Expr(LambdaExprClass, Empty),<br>+      NumCaptures(NumCaptures), CaptureDefault(LCD_None), ExplicitParams(false),<br>+      ExplicitResultType(false), HasArrayIndexVars(true) { <br>+    getStoredStmts()[NumCaptures] = 0;<br>+  }<br>+  <br>   Stmt **getStoredStmts() const {<br>     return reinterpret_cast<Stmt **>(const_cast<LambdaExpr *>(this) + 1);<br>   }<br>@@ -1198,6 +1206,11 @@<br>                             ArrayRef<unsigned> ArrayIndexStarts,<br>                             SourceLocation ClosingBrace);<br><br>+  /// \brief Construct a new lambda expression that will be deserialized from<br>+  /// an external source.<br>+  static LambdaExpr *CreateDeserialized(ASTContext &C, unsigned NumCaptures,<br>+                                        unsigned NumArrayIndexVars);<br>+  <br>   /// \brief Determine the default capture kind for this lambda.<br>   LambdaCaptureDefault getCaptureDefault() const {<br>     return static_cast<LambdaCaptureDefault>(CaptureDefault);<br>@@ -1271,9 +1284,7 @@<br>   CXXMethodDecl *getCallOperator() const;<br><br>   /// \brief Retrieve the body of the lambda.<br>-  CompoundStmt *getBody() const {<br>-    return reinterpret_cast<CompoundStmt *>(getStoredStmts()[NumCaptures]);<br>-  }<br>+  CompoundStmt *getBody() const;<br><br>   /// \brief Determine whether the lambda is mutable, meaning that any<br>   /// captures values can be modified.<br><br>Modified: cfe/trunk/include/clang/Serialization/ASTBitCodes.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTBitCodes.h?rev=150491&r1=150490&r2=150491&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTBitCodes.h?rev=150491&r1=150490&r2=150491&view=diff</a><br>==============================================================================<br>--- cfe/trunk/include/clang/Serialization/ASTBitCodes.h (original)<br>+++ cfe/trunk/include/clang/Serialization/ASTBitCodes.h Tue Feb 14 11:54:36 2012<br>@@ -1180,7 +1180,8 @@<br>       // ARC<br>       EXPR_OBJC_BRIDGED_CAST,     // ObjCBridgedCastExpr<br><br>-      STMT_MS_DEPENDENT_EXISTS    // MSDependentExistsStmt<br>+      STMT_MS_DEPENDENT_EXISTS,   // MSDependentExistsStmt<br>+      EXPR_LAMBDA                 // LambdaExpr<br>     };<br><br>     /// \brief The kinds of designators that can occur in a<br><br>Modified: cfe/trunk/lib/AST/ExprCXX.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprCXX.cpp?rev=150491&r1=150490&r2=150491&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprCXX.cpp?rev=150491&r1=150490&r2=150491&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/AST/ExprCXX.cpp (original)<br>+++ cfe/trunk/lib/AST/ExprCXX.cpp Tue Feb 14 11:54:36 2012<br>@@ -832,6 +832,16 @@<br>                               ClosingBrace);<br> }<br><br>+LambdaExpr *LambdaExpr::CreateDeserialized(ASTContext &C, unsigned NumCaptures,<br>+                                           unsigned NumArrayIndexVars) {<br>+  unsigned Size = sizeof(LambdaExpr) + sizeof(Stmt *) * (NumCaptures + 1);<br>+  if (NumArrayIndexVars)<br>+    Size += sizeof(VarDecl) * NumArrayIndexVars<br>+          + sizeof(unsigned) * (NumCaptures + 1);<br>+  void *Mem = C.Allocate(Size);<br>+  return new (Mem) LambdaExpr(EmptyShell(), NumCaptures, NumArrayIndexVars > 0);<br>+}<br>+<br> LambdaExpr::capture_iterator LambdaExpr::capture_begin() const {<br>   return getLambdaClass()->getLambdaData().Captures;<br> }<br>@@ -886,6 +896,13 @@<br>   return Result;<br> }<br><br>+CompoundStmt *LambdaExpr::getBody() const {<br>+  if (!getStoredStmts()[NumCaptures])<br>+    getStoredStmts()[NumCaptures] = getCallOperator()->getBody();<br>+    <br>+  return reinterpret_cast<CompoundStmt *>(getStoredStmts()[NumCaptures]);<br>+}<br>+<br> bool LambdaExpr::isMutable() const {<br>   return (getCallOperator()->getTypeQualifiers() & Qualifiers::Const) == 0;<br> }<br><br>Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=150491&r1=150490&r2=150491&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=150491&r1=150490&r2=150491&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)<br>+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Tue Feb 14 11:54:36 2012<br>@@ -1050,6 +1050,7 @@<br> void ASTDeclReader::ReadCXXDefinitionData(<br>                                    struct CXXRecordDecl::DefinitionData &Data,<br>                                    const RecordData &Record, unsigned &Idx) {<br>+  // Note: the caller has deserialized the IsLambda bit already.<br>   Data.UserDeclaredConstructor = Record[Idx++];<br>   Data.UserDeclaredCopyConstructor = Record[Idx++];<br>   Data.UserDeclaredMoveConstructor = Record[Idx++];<br>@@ -1097,6 +1098,25 @@<br>   Reader.ReadUnresolvedSet(F, Data.VisibleConversions, Record, Idx);<br>   assert(Data.Definition && "Data.Definition should be already set!");<br>   Data.FirstFriend = ReadDeclAs<FriendDecl>(Record, Idx);<br>+  <br>+  if (Data.IsLambda) {<br>+    typedef LambdaExpr::Capture Capture;<br>+    CXXRecordDecl::LambdaDefinitionData &Lambda<br>+      = static_cast<CXXRecordDecl::LambdaDefinitionData &>(Data);<br>+    Lambda.NumCaptures = Record[Idx++];<br>+    Lambda.NumExplicitCaptures = Record[Idx++];<br>+    Lambda.Captures <br>+      = (Capture*)Reader.Context.Allocate(sizeof(Capture)*Lambda.NumCaptures);<br>+    Capture *ToCapture = Lambda.Captures;<br>+    for (unsigned I = 0, N = Lambda.NumCaptures; I != N; ++I) {<br>+      SourceLocation Loc = ReadSourceLocation(Record, Idx);<br>+      bool IsImplicit = Record[Idx++];<br>+      LambdaCaptureKind Kind = static_cast<LambdaCaptureKind>(Record[Idx++]);<br>+      VarDecl *Var = ReadDeclAs<VarDecl>(Record, Idx);<br>+      SourceLocation EllipsisLoc = ReadSourceLocation(Record, Idx);<br>+      *ToCapture++ = Capture(Loc, IsImplicit, Kind, Var, EllipsisLoc);<br>+    }<br>+  }<br> }<br><br> void ASTDeclReader::VisitCXXRecordDecl(CXXRecordDecl *D) {<br>@@ -1104,7 +1124,13 @@<br><br>   ASTContext &C = Reader.getContext();<br>   if (Record[Idx++]) {<br>-    D->DefinitionData = new (C) struct CXXRecordDecl::DefinitionData(D);<br>+    // Determine whether this is a lambda closure type, so that we can<br>+    // allocate the appropriate DefinitionData structure.<br>+    bool IsLambda = Record[Idx++];<br>+    if (IsLambda)<br>+      D->DefinitionData = new (C) CXXRecordDecl::LambdaDefinitionData(D);<br>+    else<br>+      D->DefinitionData = new (C) struct CXXRecordDecl::DefinitionData(D);<br><br>     // Propagate the DefinitionData pointer to the canonical declaration, so<br>     // that all other deserialized declarations will see it.<br><br>Modified: cfe/trunk/lib/Serialization/ASTReaderStmt.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=150491&r1=150490&r2=150491&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=150491&r1=150490&r2=150491&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Serialization/ASTReaderStmt.cpp (original)<br>+++ cfe/trunk/lib/Serialization/ASTReaderStmt.cpp Tue Feb 14 11:54:36 2012<br>@@ -1050,7 +1050,31 @@<br><br> void ASTStmtReader::VisitLambdaExpr(LambdaExpr *E) {<br>   VisitExpr(E);<br>-  assert(false && "Cannot deserialize lambda expressions yet");<br>+  unsigned NumCaptures = Record[Idx++];<br>+  assert(NumCaptures == E->NumCaptures);(void)NumCaptures;<br>+  unsigned NumArrayIndexVars = Record[Idx++];<br>+  E->IntroducerRange = ReadSourceRange(Record, Idx);<br>+  E->CaptureDefault = static_cast<LambdaCaptureDefault>(Record[Idx++]);<br>+  E->ExplicitParams = Record[Idx++];<br>+  E->ExplicitResultType = Record[Idx++];<br>+  E->ClosingBrace = ReadSourceLocation(Record, Idx);<br>+  <br>+  // Read capture initializers.<br>+  for (LambdaExpr::capture_init_iterator C = E->capture_init_begin(),<br>+                                      CEnd = E->capture_init_end();<br>+       C != CEnd; ++C)<br>+    *C = Reader.ReadSubExpr();<br>+  <br>+  // Read array capture index variables.<br>+  if (NumArrayIndexVars > 0) {<br>+    unsigned *ArrayIndexStarts = E->getArrayIndexStarts();<br>+    for (unsigned I = 0; I != NumCaptures + 1; ++I)<br>+      ArrayIndexStarts[I] = Record[Idx++];<br>+    <br>+    VarDecl **ArrayIndexVars = E->getArrayIndexVars();<br>+    for (unsigned I = 0; I != NumArrayIndexVars; ++I)<br>+      ArrayIndexVars[I] = ReadDeclAs<VarDecl>(Record, Idx);<br>+  }<br> }<br><br> void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {<br>@@ -2083,6 +2107,14 @@<br>     case EXPR_ATOMIC:<br>       S = new (Context) AtomicExpr(Empty);<br>       break;<br>+        <br>+    case EXPR_LAMBDA: {<br>+      unsigned NumCaptures = Record[ASTStmtReader::NumExprFields];<br>+      unsigned NumArrayIndexVars = Record[ASTStmtReader::NumExprFields + 1];<br>+      S = LambdaExpr::CreateDeserialized(Context, NumCaptures, <br>+                                         NumArrayIndexVars);<br>+      break;<br>+    }<br>     }<br><br>     // We hit a STMT_STOP, so we're done with this expression.<br><br>Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=150491&r1=150490&r2=150491&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=150491&r1=150490&r2=150491&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)<br>+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Tue Feb 14 11:54:36 2012<br>@@ -4274,6 +4274,7 @@<br> void ASTWriter::AddCXXDefinitionData(const CXXRecordDecl *D, RecordDataImpl &Record) {<br>   assert(D->DefinitionData);<br>   struct CXXRecordDecl::DefinitionData &Data = *D->DefinitionData;<br>+  Record.push_back(Data.IsLambda);<br>   Record.push_back(Data.UserDeclaredConstructor);<br>   Record.push_back(Data.UserDeclaredCopyConstructor);<br>   Record.push_back(Data.UserDeclaredMoveConstructor);<br>@@ -4325,6 +4326,24 @@<br>   AddUnresolvedSet(Data.VisibleConversions, Record);<br>   // Data.Definition is the owning decl, no need to write it. <br>   AddDeclRef(Data.FirstFriend, Record);<br>+  <br>+  // Add lambda-specific data.<br>+  if (Data.IsLambda) {<br>+    CXXRecordDecl::LambdaDefinitionData &Lambda = D->getLambdaData();<br>+    Record.push_back(Lambda.NumCaptures);<br>+    Record.push_back(Lambda.NumExplicitCaptures);<br>+    for (unsigned I = 0, N = Lambda.NumCaptures; I != N; ++I) {<br>+      LambdaExpr::Capture &Capture = Lambda.Captures[I];<br>+      AddSourceLocation(Capture.getLocation(), Record);<br>+      Record.push_back(Capture.isImplicit());<br>+      Record.push_back(Capture.getCaptureKind()); // FIXME: stable!<br>+      VarDecl *Var = Capture.capturesVariable()? Capture.getCapturedVar() : 0;<br>+      AddDeclRef(Var, Record);<br>+      AddSourceLocation(Capture.isPackExpansion()? Capture.getEllipsisLoc()<br>+                                                 : SourceLocation(), <br>+                        Record);<br>+    }<br>+  }<br> }<br><br> void ASTWriter::ReaderInitialized(ASTReader *Reader) {<br><br>Modified: cfe/trunk/lib/Serialization/ASTWriterStmt.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=150491&r1=150490&r2=150491&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=150491&r1=150490&r2=150491&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Serialization/ASTWriterStmt.cpp (original)<br>+++ cfe/trunk/lib/Serialization/ASTWriterStmt.cpp Tue Feb 14 11:54:36 2012<br>@@ -1024,7 +1024,34 @@<br><br> void ASTStmtWriter::VisitLambdaExpr(LambdaExpr *E) {<br>   VisitExpr(E);<br>-  assert(false && "Cannot serialize lambda expressions yet");<br>+  Record.push_back(E->NumCaptures);<br>+  unsigned NumArrayIndexVars = 0;<br>+  if (E->HasArrayIndexVars)<br>+    NumArrayIndexVars = E->getArrayIndexStarts()[E->NumCaptures];<br>+  Record.push_back(NumArrayIndexVars);<br>+  Writer.AddSourceRange(E->IntroducerRange, Record);<br>+  Record.push_back(E->CaptureDefault); // FIXME: stable encoding<br>+  Record.push_back(E->ExplicitParams);<br>+  Record.push_back(E->ExplicitResultType);<br>+  Writer.AddSourceLocation(E->ClosingBrace, Record);<br>+  <br>+  // Add capture initializers.<br>+  for (LambdaExpr::capture_init_iterator C = E->capture_init_begin(),<br>+                                      CEnd = E->capture_init_end();<br>+       C != CEnd; ++C) {<br>+    Writer.AddStmt(*C);<br>+  }<br>+  <br>+  // Add array index variables, if any.<br>+  if (NumArrayIndexVars) {<br>+    Record.append(E->getArrayIndexStarts(), <br>+                  E->getArrayIndexStarts() + E->NumCaptures + 1);<br>+    VarDecl **ArrayIndexVars = E->getArrayIndexVars();<br>+    for (unsigned I = 0; I != NumArrayIndexVars; ++I)<br>+      Writer.AddDeclRef(ArrayIndexVars[I], Record);<br>+  }<br>+  <br>+  Code = serialization::EXPR_LAMBDA;<br> }<br><br> void ASTStmtWriter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {<br><br>Added: cfe/trunk/test/PCH/cxx11-lambdas.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/cxx11-lambdas.cpp?rev=150491&view=auto">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/cxx11-lambdas.cpp?rev=150491&view=auto</a><br>==============================================================================<br>--- cfe/trunk/test/PCH/cxx11-lambdas.cpp (added)<br>+++ cfe/trunk/test/PCH/cxx11-lambdas.cpp Tue Feb 14 11:54:36 2012<br>@@ -0,0 +1,43 @@<br>+// RUN: %clang_cc1 -pedantic-errors -std=c++11 -emit-pch %s -o %t-cxx11<br>+// RUN: %clang_cc1 -ast-print -pedantic-errors -std=c++11 -include-pch %t-cxx11  %s | FileCheck -check-prefix=CHECK-PRINT %s<br>+<br>+#ifndef HEADER_INCLUDED<br>+<br>+#define HEADER_INCLUDED<br>+template<typename T><br>+T add_slowly(const T& x, const T &y) {<br>+  return [=, &y] { return x + y; }();<br>+};<br>+<br>+inline int add_int_slowly_twice(int x, int y) {<br>+  int i = add_slowly(x, y);<br>+  auto lambda = [&](int z) { return x + z; };<br>+  return i + lambda(y);<br>+}<br>+<br>+inline int sum_array(int n) {<br>+  int array[5] = { 1, 2, 3, 4, 5};<br>+  auto lambda = [=](int N) -> int {<br>+    int sum = 0;<br>+    for (unsigned I = 0; I < N; ++I)<br>+      sum += array[N];<br>+    return sum;<br>+  };<br>+<br>+  return lambda(n);<br>+}<br>+#else<br>+<br>+// CHECK-PRINT: float add_slowly<br>+// CHECK-PRINT: return [=, &y]<br>+template float add_slowly(const float&, const float&);<br>+<br>+// CHECK-PRINT: int add_slowly<br>+// CHECK-PRINT: return [=, &y]<br>+int add(int x, int y) {<br>+  return add_int_slowly_twice(x, y) + sum_array(4);<br>+}<br>+<br>+// CHECK-PRINT: inline int add_int_slowly_twice <br>+// CHECK-PRINT: lambda = [&] (int z)<br>+#endif<br><br>Propchange: cfe/trunk/test/PCH/cxx11-lambdas.cpp<br>------------------------------------------------------------------------------<br>    svn:eol-style = native<br><br>Propchange: cfe/trunk/test/PCH/cxx11-lambdas.cpp<br>------------------------------------------------------------------------------<br>    svn:keywords = Id<br><br>Propchange: cfe/trunk/test/PCH/cxx11-lambdas.cpp<br>------------------------------------------------------------------------------<br>    svn:mime-type = text/plain<br><br><br>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br></div></blockquote></div><br></div></div></blockquote></div><br></div></div></blockquote></div><br></body></html>