coroutines: Pass class reference to promise param preview [PR94682]
authorIain Sandoe <iain@sandoe.co.uk>
Wed, 22 Apr 2020 08:49:20 +0000 (09:49 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Wed, 22 Apr 2020 08:49:20 +0000 (09:49 +0100)
commit38644f81babd04820daa9d622ea75eb68c066c86
tree61495547ef6245a0200874f9d3cfec0ee10d0268
parent9ad3c1d81c129fc76594b9df5b798c380cbf03ee
coroutines: Pass class reference to promise param preview [PR94682]

As reported in the PR, per [dcl.fct.def.coroutine]/4 we should
be passing a reference to the object to the promise parameter
preview, and we are currently passing a pointer (this).  Amend to
pass the reference.

gcc/cp/ChangeLog:

2020-04-22  Iain Sandoe  <iain@sandoe.co.uk>

PR c++/94682
* coroutines.cc (struct param_info): Add a field to note that
the param is 'this'.
(morph_fn_to_coro): Convert this to a reference before using it
in the promise parameter preview.

gcc/testsuite/ChangeLog:

2020-04-22  Iain Sandoe  <iain@sandoe.co.uk>

PR c++/94682
* g++.dg/coroutines/pr94682-preview-this.C: New test.
gcc/cp/ChangeLog
gcc/cp/coroutines.cc
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/coroutines/pr94682-preview-this.C [new file with mode: 0644]