]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: non-dependent call to consteval operator [PR105912]
authorPatrick Palka <ppalka@redhat.com>
Wed, 13 Jul 2022 18:02:08 +0000 (14:02 -0400)
committerPatrick Palka <ppalka@redhat.com>
Wed, 13 Jul 2022 18:02:08 +0000 (14:02 -0400)
commitf70c18524221dcefa6cd26cee7b55503181bd912
tree1690ad6b63b5c02a45054a0b423cdd42aed0c404
parentf07778f6f92111aa0abfd0f669b148a0bda537a9
c++: non-dependent call to consteval operator [PR105912]

Here we're crashing when substituting a non-dependent call to a
consteval operator, whose CALL_EXPR_OPERATOR_SYNTAX flag we try to
propagate to the result, but the result isn't a CALL_EXPR since the
selected function is consteval.  This patch fixes this by checking the
result of extract_call_expr accordingly.  (Note that we can't check
DECL_IMMEDIATE_FUNCTION_P here because we don't know which function was
selected by overload resolution from here.)

PR c++/105912

gcc/cp/ChangeLog:

* pt.cc (tsubst_copy_and_build) <case CALL_EXPR>: Guard against
NULL_TREE extract_call_expr result.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/consteval31.C: New test.
gcc/cp/pt.cc
gcc/testsuite/g++.dg/cpp2a/consteval31.C [new file with mode: 0644]