On 7/24/24 4:52 PM, Arsen Arsenović wrote:
Jason Merrill <ja...@redhat.com> writes:
Ah, of course, I was overlooking the assignment. The patch is OK.
Thanks. Here's a range diff with a few changes to the commits, chiefly
in the commit messages. If you agree, I can push with these changes
applied:
Looks good, thanks.
1: 32f810cca55 ! 1: d2e74525965 cp/coroutines: do not rewrite parameters in
unevaluated contexts
@@ Commit message
parameters. Prevent this by simply skipping rewrites in unevaluated
contexts. Those won't mind the value not being present anyway.
+ This prevents an ICE during parameter substitution. In the testcase
+ from the PR, the rewriting machinery finds a param in the body of the
+ coroutine, which it did not previously encounter while processing the
+ coroutine declaration, and that does not have a DECL_VALUE_EXPR, and
+ fails.
+
gcc/cp/ChangeLog:
PR c++/111728
@@ gcc/cp/coroutines.cc: rewrite_param_uses (tree *stmt, int *do_subtree
ATTRIBUTE_
+ if (unevaluated_p (TREE_CODE (*stmt)))
+ {
-+ *do_subtree = 0; // Nothing to do.
++ /* No odr-uses in unevaluated operands. */
++ *do_subtree = 0;
+ return NULL_TREE;
+ }
+
2: a16f1d34047 ! 2: adc77c732f5 cp+coroutines: teach convert_to_void to
diagnose discarded co_awaits
@@ Commit message
as such, should inherit its nodiscard. A discarded co_await
expression
should, hence, act as if its call to await_resume was discarded.
- CO_AWAIT_EXPR trees do conveniently contain the expression for calling
- await_resume in them, so we can discard it.
+ This patch teaches convert_to_void how to discard 'through' a
+ CO_AWAIT_EXPR. When we discard a CO_AWAIT_EXPR, we can also just
discard
+ the await_resume() call conveniently embedded within it. This results
+ in a [[nodiscard]] diagnostic that the PR noted was missing.
gcc/cp/ChangeLog:
Thanks again, have a lovely evening.