https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120775

--- Comment #24 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Desmond Gold from comment #22)
> https://godbolt.org/z/qP8988P5b

#include <meta>

using namespace std::meta;

template <typename>
void
foo ()
{
  constexpr int i = [: reflect_constant (5) :];
  constexpr info f = reflect_constant_array (std::vector { 1, 2, 3 });
  constexpr auto &arr = [: f :];
  constexpr auto &arr2 = [: reflect_constant_array (std::vector { 1, 2, 3 })
:];
}

void
bar ()
{
  constexpr auto &arr = [: reflect_constant_array (std::vector { 1, 2, 3 }) :]; 
}

int
main ()
{
}

splice calls cxx_constant_value when processing_template_decl, that looks
unexpected, I think normally we'd call fold_non_dependent_expr instead when
processing_template_decl.
Anyway, the ICE is because get_range_elts sees the processing_template_decl
specific trees like CAST_EXPR with std::vector <int> type instead of the
expected const std::vector <int> &&.

Reply via email to