Open xmh0511 opened 11 months ago
The case can never match the second form of the if statement, instead, it always matches the first form of the if statement
Maybe because of this "shall"?
"shall" is misused here
It is OK here, it is a requirement on an implementation how it shall disambiguate grammar
It is OK here, it is a requirement on an implementation how it shall disambiguate grammar
The reading is intended but hard to be parsed from the current wording.
I prefer to slightly rewrite the syntax notations:
one-branched-if-statement: attribute-specifier-seq opt
if
constexpr
opt(
init-statement opt condition)
statementelsable-statement: any statement except for one-branched-if-statement
selection-statement: [...]
if
constexpr
opt(
init-statement opt condition)
elsable-statementelse
statement [...]
It is OK here, it is a requirement on an implementation how it shall disambiguate grammar
As we discussed in other issues, violating "shall" should give a diagnosis anyway, the program is ill-formed in this situation.
Full name of submitter (unless configured in github; will be published with the issue): Jim X
First, as discussed in other issues, "shall" is misused here, consider a concrete example:
The case can never match the second form of the if statement, instead, it always matches the first form of the if statement and interprets
if(false){std::cout<<"true\n";} else {std::cout<<"executed\n";}
as the substatement of the if statement. In other words, we couldn't construct a case, if the first substatement of the if statement is itself a complete second form of an if statement, such that the whole statement would be considered as the second form.Suggested Resolution
At best, the sentence together with the associated note should be as a note.