[Bug c++/107024] ICE in finish_expr_stmt, at cp/semantics.cc:872
marxin at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Sep 26 12:27:45 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107024
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Test-case:
#include <iostream>
#include <utility>
#include <vector>
template <size_t...NN>
struct Integral_pack
{
static constexpr size_t data[sizeof...(NN)] = { NN... };
std::vector<size_t> vec { NN... };
};
template <size_t N, auto Exp, size_t...NN>
consteval auto apply_fold_impl(std::index_sequence<NN...>)
{
return Integral_pack<Exp(N, NN)...>{};
};
template <size_t N, auto Exp, size_t C>
consteval auto apply_fold()
{
return apply_fold_impl<N, Exp>(std::make_index_sequence<C>{});
}
template <size_t N, size_t C>
using left_shift
= decltype(apply_fold<N, [](size_t L, size_t R) { return (L << R); },
C>());
template <size_t N, size_t C>
auto ls_vec = left_shift<N, C>{}.vec;
template <size_t N, size_t C>
using right_shift
= decltype(apply_fold<N, [](size_t L, size_t R) { return (L >> R); },
C>());
template <size_t N, size_t C>
std::vector<size_t> rs_vec = right_shift<N, C>{}.vec;
int main()
{
for(auto& i : ls_vec<12351, 15>) std::cout << i << " ";
std::cout << "\n";
for(auto& i : rs_vec<12351, 15>) std::cout << i << " ";
std::cout << "\n";
}
More information about the Gcc-bugs
mailing list