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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
A test without a lambda that ICEs with -std=c++14 too:

enum E : int { F };
struct X {
  E e{F};
};
constexpr X x[1];

auto
foo ()
{
  return x[0].e;
}

Note that we don't ICE if the X's member is changed to E e{1};.  The difference
is that for the former reduced_constant_expression_p says false (due to the
CONST_DECL F), so we cxx_eval_bare_aggregate and verify_ctor_sanity in
cxx_eval_constant_expression/CONSTRUCTOR.  With e{1}
reduced_constant_expression_p is true and we don't call
cxx_eval_bare_aggregate.

Reply via email to