-
Notifications
You must be signed in to change notification settings - Fork 781
Description
In subclause 8.2.3 [expr.type.conv] paragraph 2 of the 2017 DIS, the structure of:
If the initializer is a parenthesized single expression, the type conversion expression is equivalent (in definedness, and if defined in meaning) to the corresponding cast expression ([expr.cast]).
If the type is cvvoid
and the initializer is()
, [ ... ].
Otherwise, [an] object is direct-initialized (11.6) with the initializer.
Presents a interpretation where the first sentence is elaborated upon by the latter two as opposed to covering disjoint cases.
Given:
int *f(void *p) {
typedef int *IntPtr;
return IntPtr(p);
}
The C-style cast interpretation is valid; however, the direct-initialization is not.
Thus the first sentence conflicts with the latter two under said interpretation.
Furthermore, the parenthetical in the first sentence is meant to be parsed as:
equivalent (in definedness; and if defined, in meaning) to the corresponding cast expression
However, it may be taken as:
equivalent in definedness, should the corresponding cast expression be defined
Suggestion:
Move the latter two sentences under an "Otherwise" bound to the first, with appropriate indentation.
Indent the "then" part of the first as well.
Suggestion:
Improve punctuation within the parenthetical in the first sentence.