Commit bf66b9b4 by Aldy Hernandez Committed by Aldy Hernandez

re PR c++/65295 ([C++1y] constexpr function causes ICE if it returns a local…

re PR c++/65295 ([C++1y] constexpr function causes ICE if it returns a local variable bigger than 16 bytes)

	PR c++/65295
	* constexpr.c (cxx_eval_constant_expression): Remove assert in
	RESULT_DECL handling.

From-SVN: r221161
parent 71ca36ba
2015-03-03 Aldy Hernandez <aldyh@redhat.com>
PR c++/65295
* constexpr.c (cxx_eval_constant_expression): Remove assert in
RESULT_DECL handling.
2015-02-26 Marek Polacek <polacek@redhat.com>
PR c++/65202
......
......@@ -2955,8 +2955,8 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
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));
through an invisible reference, or in named return value
optimization. */
return (*ctx->values->get (t));
case VAR_DECL:
......
// { dg-do compile }
// { dg-options "-std=c++1y" }
struct arr {
constexpr arr() : elem() { }
char elem[17];
};
constexpr
arr f()
{
arr result;
return result;
}
constexpr arr a { f() };
int main()
{
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment