[LLVMbugs] [Bug 17798] New: Regression: std::function cannot be assigned a lambda function

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Nov 4 05:28:38 PST 2013


            Bug ID: 17798
           Summary: Regression: std::function cannot be assigned a lambda
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jonathan.sauer at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 11481
  --> http://llvm.org/bugs/attachment.cgi?id=11481&action=edit
Complete log

The following code does not compile with clang r193986 and libc++ r193989, even
though it compiled successfully with clang r193515:

#include <functional>

template <typename F>
static void foo(F f)
    std::function<void()> func = f;

int main()
    foo([]() {});

This results in (complete log attached):

% ~/LLVM/build/Release+Asserts/bin/clang++ -std=c++11 -stdlib=libc++ -v
clang version 3.4 (trunk 193986)
Target: x86_64-apple-darwin10.8.0
In file included from clang.cpp:1:
In file included from /usr/include/c++/v1/functional:477:
In file included from /usr/include/c++/v1/memory:603:
/usr/include/c++/v1/tuple:267:11: error: rvalue reference to type '<lambda at
clang.cpp:12:9>' cannot bind to lvalue of
      type '<lambda at clang.cpp:12:9>'

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131104/b666ffdc/attachment.html>

More information about the llvm-bugs mailing list