[LLVMbugs] [Bug 15365] New: Capturing a const reference parameter by value in lambda fails to correctly generate constructor/destructor calls of captured value

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 26 10:23:34 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=15365

            Bug ID: 15365
           Summary: Capturing a const reference parameter by value in
                    lambda fails to correctly generate
                    constructor/destructor calls of captured value
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: erik.olofsson at hansoft.se
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 10082
  --> http://llvm.org/bugs/attachment.cgi?id=10082&action=edit
Reproduces the bug

Compile attached file with
clang++ -std=c++11 -stdlib=libc++ TestFunctional.cpp -o TestFunctional

The relevant function:

void Capture(std::function<void (CDispatchTypeTag *)> const &_Function)
{
  //auto Function = _Function; // Uncomment this and it works
  auto fTest
    = [_Function]()
    {
      _Function(nullptr);
    }
  ;
}

The destructor and copy constructor is not called the correct number of times
unless the line above is uncommented.

-- 
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/20130226/9d53f786/attachment.html>


More information about the llvm-bugs mailing list