<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Frontend segmentation fault involving C++20 lambda template"
href="https://bugs.llvm.org/show_bug.cgi?id=49470">49470</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Frontend segmentation fault involving C++20 lambda template
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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++2a
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>pkeir@outlook.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=24600" name="attach_24600" title="The C++ file producing the seg fault">attachment 24600</a> <a href="attachment.cgi?id=24600&action=edit" title="The C++ file producing the seg fault">[details]</a></span>
The C++ file producing the seg fault
Attempting to compile the program below (and attached) produces a clang
frontend command failure and segmentation fault on 64-bit Ubuntu 20.10 with
the command `clang++ -std=c++2a zip_with.cpp`.
#include <array>
template <typename F, typename T, std::size_t N, typename... As>
constexpr auto zip_with(const F f, const std::array<T, N>& a, const As&... as)
{
auto vred = [&]<std::size_t I>() { return f(a[I],as[I]...); };
auto iseq = [&]<typename I, I... Is>(std::integer_sequence<I,Is...>) {
return std::array{vred.template operator()<Is>()...};
};
return iseq(std::make_index_sequence<N>{});
}
int main(int argc, char *argv[])
{
std::array x{1,2,3}, y{4,5,6};
zip_with([](int a, int b) { return a+b; }, x, y);
return 0;
}</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>