[LLVMbugs] [Bug 18568] New: Crash: lambda capturing templated object with initializer

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 21 02:29:03 PST 2014


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

            Bug ID: 18568
           Summary: Crash: lambda capturing templated object with
                    initializer
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: trick at icculus.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Compiling this with c++11 or c++1y crashes clang 3.4 and latest git:

/tmp/crash-clang-f9c4f5.cpp:
-- 8< --
# 1 "<built-in>" 1
# 1 "crash-clang.cpp" 1
template <typename T>
struct Foo
{
        Foo (int) {}
        void tick () const {}
};

template <typename T>
void crash ()
{
        Foo<T> foo(3);
        auto x = [=]{
                foo.tick();
        };
}
-- 8< --
(compile with clang++ -std=c++11 -c crash-clang.cpp)

It doesn't crash if Foo is not a template, or if (3) is changed to {3}, or if
the lambda doesn't capture foo.

/tmp/crash-clang-f9c4f5.sh:
 "/tmp/clang+llvm-3.4-x86_64-linux-gnu-ubuntu-13.10/bin/clang" -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name crash-clang.cpp -mrelocation-model
static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version
2.23.90.20131017 -std=c++11 -fdeprecated-macro -ferror-limit 19
-fmessage-length 113 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -x
c++ crash-clang-f9c4f5.cpp

-- 
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/20140121/5a9ce1ef/attachment.html>


More information about the llvm-bugs mailing list