[llvm-bugs] [Bug 49470] New: Frontend segmentation fault involving C++20 lambda template

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Mar 7 15:23:47 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=49470

            Bug ID: 49470
           Summary: Frontend segmentation fault involving C++20 lambda
                    template
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: pkeir at outlook.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Created attachment 24600
  --> https://bugs.llvm.org/attachment.cgi?id=24600&action=edit
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;
}

-- 
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/20210307/4d04df44/attachment.html>


More information about the llvm-bugs mailing list