Commit 9014cb7c by Jason Merrill

c++: Fix consteval operator handling.

We were crashing trying to find the CALL_EXPR in the result of a call to a
consteval operator.

gcc/cp/ChangeLog:

	* call.c (build_new_op_1): Don't look for a CALL_EXPR when
	calling a consteval function.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/consteval17.C: New test.
parent 60bd3f20
......@@ -6307,7 +6307,7 @@ build_new_op_1 (const op_location_t &loc, enum tree_code code, int flags,
result = build_over_call (cand, LOOKUP_NORMAL, ocomplain);
}
if (trivial_fn_p (cand->fn))
if (trivial_fn_p (cand->fn) || DECL_IMMEDIATE_FUNCTION_P (cand->fn))
/* There won't be a CALL_EXPR. */;
else if (result && result != error_mark_node)
{
......
// { dg-do compile { target c++20 } }
struct A
{
consteval int operator+() { return 42; }
};
int main()
{
+A();
}
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