Skip to content

[expr.call] Itemize to clarify sequencing ambiguity #8116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Eisenwave
Copy link
Member

The current wording is ambiguous and can be read in two ways:

The

  • initialization of a parameter or,
  • if the implementation introduces any temporary objects to hold the values of function parameters ([class.temporary]), the initialization of those temporaries,

including every associated value computation and side effect,
is indeterminately sequenced with respect to that of any other parameter.

OR

The

  • initialization of a parameter or,
  • if the implementation introduces any temporary objects to hold the values of function parameters ([class.temporary]), the initialization of those temporaries,
    including every associated value computation and side effect,

is indeterminately sequenced with respect to that of any other parameter.

I think it's fairly clear that we want "including every associated value computation and side effect" to apply to either case, and this also matches the original wording in https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0145r3.pdf

Besides the ambiguity, the wording is mentally demanding from the reader, and bullets help tidy it up.

@killerbee13
Copy link

As far as I can tell, the general wording in https://eel.is/c++draft/dcl.init#general-19 would mean that there is no reason to include this particular clause in this sentence to begin with, and perhaps it should simply be removed since its binding is somewhat ambiguous and the sentence is rather verbose. However, that is not quite as clear as https://eel.is/c++draft/intro.execution#8.sentence-7 is as to whether "includes" means that sequencing is also propagated downward. Unless it is intended that "initializations" can be sequenced but their side effects and value computations not be sequenced, which as far as I can tell it never is, I think a similarly strong statement should be made generally, rather than calling it out individually in all of those cases where initializations aren't already also full-expressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants