llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.98k stars 11.55k forks source link

LLVM ERROR: out of memory Allocation failed #100934

Open n0F4x opened 1 month ago

n0F4x commented 1 month ago

Clang_dump.zip

n0F4x commented 1 month ago

I figured out my mistake as shown with a comment.

namespace details {

template <typename Tuple, typename Generator, size_t... Ints>
auto generate_tuple(Generator generator, std::index_sequence<Ints...>) -> Tuple
{
    return Tuple {
        generator.template operator()<std::tuple_element_t<Ints, Tuple>>()...
    };
}

}   // namespace details

template <meta::tuple_like Tuple, typename Generator>
auto generate_tuple(Generator generator) -> Tuple
{
    constexpr static size_t size{ std::tuple_size_v<Tuple> };

    if constexpr (size == 0) {
        return Tuple{};
    }

    using Indices = std::make_index_sequence<size - 1>; // THIS SHOULD BE 'size' INSTEAD OF 'size-1'
    return details::generate_tuple<Tuple>(generator, Indices{});
}