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

            Bug ID: 92015
           Summary: internal compiler error: in cxx_eval_array_reference,
                    at cp/constexpr.c:2568
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ed at catmur dot uk
  Target Milestone: ---

when indexing a char array initialized from a string literal in constexpr
context:

struct S1 { char c[6] {'h', 'e', 'l', 'l', 'o', 0}; };
struct S2 { char c[6] = "hello"; };
static_assert(S1{}.c[0] == 'h');    // OK
static_assert(S2{}.c[0] == 'h');    // ICE

Expected: both static_asserts pass.

According to Godbolt, this ICE was introduced between 8.3 and 9.1, and is still
present in 10.0.

Reply via email to