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

            Bug ID: 108266
           Summary: [13 Regression] ICE during
                    cxx_eval_constant_expression on IMPLICIT_CONV_EXPR
                    since r13-4564
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

#include <initializer_list>
#include <vector>

struct S { S (const char *); };
void bar (std::vector<S>);

template <int N>
void
foo ()
{
  bar ({"", ""});
}

void
baz ()
{
  foo<0> ();
}

ICEs with -std=c++20 starting with
r13-4564-gd081807d8d70e3e87eae41e1560e54d503f4d465
internal compiler error: unexpected expression '(S)""' of kind
implicit_conv_expr
   11 |   bar ({"", ""});
      |   ~~~~^~~~~~~~~~
In Fedora test mass rebuilds I saw 33 ICEs like that.
Instead of the includes one can use just
namespace std {
template <class T> struct initializer_list { const T *ptr; decltype (sizeof 0)
len; };
template <typename T> struct vector { vector (initializer_list<T>); };
}
to get the same ICE.

The problem is that maybe_init_list_as_range -> maybe_init_list_as_array ->
maybe_constant_init is called when processing_template_decl (from
build_user_type_conversion_1).  Wonder if the call shouldn't be skipped for
processing_template_decl, or whether say maybe_init_list_as_range shouldn't
always return NULL if processing_template_decl.

Reply via email to