[PATCH] D67743: [Consumed] Treat by-value class arguments as consuming by default, like rvalue refs.

Nicholas Allegra via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 19 15:57:51 PDT 2019


comex added a comment.

In D67743#1675533 <https://reviews.llvm.org/D67743#1675533>, @dblaikie wrote:

> "Also, fix the order of if statements so that an explicit return_typestate annotation takes precedence over the default behavior for rvalue refs."
>
> I'd probably have split that out into a separate patch - in part to discuss the design implications of that. I have some doubts about supporting non-consumed after passing by rvalue ref, but don't feel too strongly & the alternative would be having a warning about the attribute being ignored, etc - when it has a fairly clear meaning if it is there, just not sure people 'should' be doing that.


Fair enough.  I agree there's not much reason to do that, but it also seems pretty harmless to respect the user's choice.  Silently ignoring the attribute as before is obviously wrong, so the alternative would be adding a diagnostic for that case, but it doesn't seem worth it...

> unless these are testing something noteworthy about them being static functions I'd probably suggest making them non-members like the other test functions below, for consistency (otherwise the inconsistency tends to raise the question of "what is significant about this difference?")

Okay, I'll change them to non-members before committing.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67743/new/

https://reviews.llvm.org/D67743





More information about the cfe-commits mailing list