<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Crash: lambda capturing templated object with initializer"
href="http://llvm.org/bugs/show_bug.cgi?id=18568">18568</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Crash: lambda capturing templated object with initializer
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>trick@icculus.org
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>