Commit 4ddcdbf9 by Jason Merrill Committed by Jason Merrill

PR c++/70344 - ICE with recursive constexpr

	* constexpr.c (cxx_eval_call_expression): Check for
	fun == current_function_decl again.

From-SVN: r236625
parent 40e61ad8
2016-05-23 Jason Merrill <jason@redhat.com> 2016-05-23 Jason Merrill <jason@redhat.com>
PR c++/70344
* constexpr.c (cxx_eval_call_expression): Check for
fun == current_function_decl again.
PR c++/70584 PR c++/70584
* cp-gimplify.c (cp_fold) [INDIRECT_REF]: Call * cp-gimplify.c (cp_fold) [INDIRECT_REF]: Call
maybe_undo_parenthesized_ref. maybe_undo_parenthesized_ref.
......
...@@ -1371,11 +1371,17 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t, ...@@ -1371,11 +1371,17 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
else else
{ {
new_call.fundef = retrieve_constexpr_fundef (fun); new_call.fundef = retrieve_constexpr_fundef (fun);
if (new_call.fundef == NULL || new_call.fundef->body == NULL) if (new_call.fundef == NULL || new_call.fundef->body == NULL
|| fun == current_function_decl)
{ {
if (!ctx->quiet) if (!ctx->quiet)
{ {
if (DECL_INITIAL (fun) == error_mark_node) /* We need to check for current_function_decl here in case we're
being called during cp_fold_function, because at that point
DECL_INITIAL is set properly and we have a fundef but we
haven't lowered invisirefs yet (c++/70344). */
if (DECL_INITIAL (fun) == error_mark_node
|| fun == current_function_decl)
error_at (loc, "%qD called in a constant expression before its " error_at (loc, "%qD called in a constant expression before its "
"definition is complete", fun); "definition is complete", fun);
else if (DECL_INITIAL (fun)) else if (DECL_INITIAL (fun))
......
// PR c++/70344 // PR c++/70344
// { dg-do compile { target c++11 } } // { dg-do compile { target c++11 } }
// { dg-options -O }
struct Z struct Z
{ {
......
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