[expr.call] The value computation of a function call and the evaluations of expressions within the function body are not specified
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
bool fun(){
int a = 0, b, c = 0;
b = ++a;
return c = a++;
}
bool r = !fun();
The current wording does not seem to specify the value computation of the function call expression fun() and the evaluation of expressions within the function body(e.g. the side effect of expression a). Every evaluation of the expressions before return statement ought to be guaranteed to be sequenced before the value computation of the function call. There is no explicit wording for this point. The relevant wording about the sequence for function call are defined in [expr.call] and [basic.exec]
[expr.call] p8
The postfix-expression is sequenced before each expression in the expression-list and any default argument. The initialization of a parameter, including every associated value computation and side effect, is indeterminately sequenced with respect to that of any other parameter.
[intro.execution] p11
When invoking a function (whether or not the function is inline), every argument expression and the postfix expression designating the called function are sequenced before every expression or statement in the body of the called function. For each function invocation or evaluation of an await-expression F, each evaluation that does not occur within F but is evaluated on the same thread and as part of the same signal handler (if any) is either sequenced before all evaluations that occur within F or sequenced after all evaluations that occur within F;39 if F invokes or resumes a coroutine ([expr.await]), only evaluations subsequent to the previous suspension (if any) and prior to the next suspension (if any) are considered to occur within F.
Neither of them can clarify the above issue.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the cited [expr.call] p8 and [intro.execution] p11 wording in the C++ draft, then trace the example's function-call and return evaluations. Determine whether the sequencing relationship is specified; done means the draft wording unambiguously resolves the example without relying on interpretation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100