[Bug c++/65295] [5 Regression] [C++1y] constexpr function causes ICE if it returns a local variable bigger than 16 bytes

aldyh at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 3 17:29:00 GMT 2015


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

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #3 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
We're failing in cxx_eval_constant_expression() because the retval is not a
DECL_BY_REFERENCE:

    case RESULT_DECL:
      if (lval)
    return t;
      /* We ask for an rvalue for the RESULT_DECL when indirecting
     through an invisible reference.  */
      gcc_assert (DECL_BY_REFERENCE (t));
      return (*ctx->values->get (t));

Jason, we also ask for an rvalue in the mentioned testcase, while returning a
newly constructed object:

constexpr arr f()
{
    arr result;
    return result;
}

Could we just remove the assert?



More information about the Gcc-bugs mailing list