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

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Dang it, hit Save Changes accidentally.

That evaluates the AGGR_INIT_EXPR inside by evaluating the constructor of
outer:

  if (m_x.value() != 0)  // 1
    throw 0;
  m_x.m_value = integer{1}.value();  // 2
  if (m_x.value() != 1) // 3
    throw 0;

1: we evaluate m_x.value() and save it to constexpr_call_table with result 0,
because were in strict mode
2: this store expression is evaluated, it changes m_value to 1
3: we try to evaluate m_x.value() again but this time we use the cached result
because we're still in strict mode.  But the result is not 0 anymore, so Bad
Stuff ensues.

So either we should prune the constexpr call table (but when?), or not cache
the result in the first place.

Reply via email to