Commit 1efb1dc2 by Marek Polacek Committed by Marek Polacek

re PR c++/84927 (ICE with NSDMI and reference)

	PR c++/84927
	* constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags
	as we evaluate the elements.
	(cxx_eval_constant_expression): Verify constructor's flags
	unconditionally.

	* g++.dg/cpp1y/nsdmi-aggr9.C: New test.

From-SVN: r258691
parent f5f035a3
2018-03-20 Marek Polacek <polacek@redhat.com>
PR c++/84978, ICE with NRVO.
* constexpr.c (cxx_eval_constant_expression): Handle the case when
a RESULT_DECL isn't in the hash map.
2018-03-20 Jason Merrill <jason@redhat.com>
PR c++/84978, ICE with NRVO.
......
......@@ -4111,7 +4111,15 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
/* We ask for an rvalue for the RESULT_DECL when indirecting
through an invisible reference, or in named return value
optimization. */
return (*ctx->values->get (t));
if (tree *p = ctx->values->get (t))
return *p;
else
{
if (!ctx->quiet)
error ("%qE is not a constant expression", t);
*non_constant_p = true;
}
break;
case VAR_DECL:
if (DECL_HAS_VALUE_EXPR_P (t))
......
2018-03-20 Marek Polacek <polacek@redhat.com>
PR c++/84978, ICE with NRVO.
* g++.dg/opt/nrv19.C: New test.
2018-03-20 Nathan Sidwell <nathan@acm.org>
PR c++/84962
......
// PR c++/84978
// { dg-do compile }
struct S {
void (*fn)();
int a[10];
};
S
foo ()
{
S s;
s.fn ();
return s;
}
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