coroutines: Make call argument handling more robust [PR95440]
authorIain Sandoe <iain@sandoe.co.uk>
Tue, 9 Jun 2020 23:15:28 +0000 (00:15 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Wed, 10 Jun 2020 19:02:45 +0000 (20:02 +0100)
commita9eec9625ea7165292958be04899b057804192fb
tree5ece325dccfd3d12ba7854207de18b21bb2a1451
parenta2c2cee92e5defff9bf23d3b1184ee96e57e5fdd
coroutines: Make call argument handling more robust [PR95440]

build_new_method_call is supposed to be able to handle a null
arguments list pointer (when the method has no parms).  There
were a couple of places where uses of the argument list pointer
were not defended against NULL.

gcc/cp/ChangeLog:

PR c++/95440
* call.c (add_candidates): Use vec_safe_length() for
testing the arguments list.
(build_new_method_call_1): Use vec_safe_is_empty() when
checking for an empty args list.

gcc/testsuite/ChangeLog:

PR c++/95440
* g++.dg/coroutines/pr95440.C: New test.
gcc/cp/call.c
gcc/testsuite/g++.dg/coroutines/pr95440.C [new file with mode: 0644]