[LLVMbugs] [Bug 12112] New: clang++ crashes with nested lambdas
    bugzilla-daemon at llvm.org 
    bugzilla-daemon at llvm.org
       
    Tue Feb 28 07:19:47 PST 2012
    
    
  
http://llvm.org/bugs/show_bug.cgi?id=12112
             Bug #: 12112
           Summary: clang++ crashes with nested lambdas
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: sandello at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified
Created attachment 8106
  --> http://llvm.org/bugs/attachment.cgi?id=8106
stderr of clang invocation
Hi there.
I was trying to compile my project with Clang and I caught assertion
"(Linkage(CachedLinkage) == getLVForDecl(this,
LVFlags::CreateOnlyDeclLinkage()).linkage())" (like in
http://llvm.org/bugs/show_bug.cgi?id=8926). Yet while trying to build a reduced
test case, I managed to crash Clang. :)
Invocation Command: ""clang++ -std=c++11 -g nested-lambdas-crash.cpp"".
LLVM & Clang r151574. Mac OS X 10.6.8. libstdc++ bundled with gcc 4.2.1.
Source code:
<pre>
#include <iostream>
#include <vector>
template <typename F>
void DoIf(bool condition, const F& func)
{
    if (condition) {
        func();
    }
}
template <typename F>
void DoForEach(const std::vector<int>& values, const F& func)
{
    for (auto it = values.begin(); it != values.end(); ++it) {
        func(*it);
    }
}
int main(int, char**)
{
    std::vector<int> myValues;
    myValues.push_back(17);
    myValues.push_back(42);
    myValues.push_back(99);
    DoIf(!myValues.empty(), [=] () {
        DoForEach(myValues, [=] (int value) {
            std::cerr << value << std::endl;
        });
    });
    return 0;
}
</pre>
Please find the invocation log in the attachements.
-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
    
    
More information about the llvm-bugs
mailing list