You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This corner case seems to be ignored by the standard, there's no rule in the current draft that criticizes the example as invalid.
First, the case is permitted by the grammar
simple-type-specifier braced-init-list
The grammar does not restrict what the braced-init-list should be(must be empty or not).
From the perspective of [expr.type.conv#2], it does not cover this case
If the initializer is a parenthesized single expression, the type conversion expression is equivalent to the corresponding cast expression. Otherwise, if the type is cv void and the initializer is () or {} (after pack expansion, if any), the expression is a prvalue of type void that performs no initialization. Otherwise, the expression is a prvalue of the specified type whose result object is direct-initialized with the initializer. If the initializer is a parenthesized optional expression-list, the specified type shall not be an array type.
According to [dcl.init#general-14]
The initialization that occurs
in a functional notation type conversion
is called direct-initialization.
So, we will inspect [dcl.init.list] for this case. Meanwhile, [dcl.init.list#3.12] is also not suitable for this case
Otherwise, the program is ill-formed.
Since its condition is:
List-initialization of an object or reference of type T is defined as follows:
A prvalue of type void does not result in "initialization". So, it arguably says that such a corner case is not covered by the standard.
The text was updated successfully, but these errors were encountered:
This corner case seems to be ignored by the standard, there's no rule in the current draft that criticizes the example as invalid.
First, the case is permitted by the grammar
From the perspective of [expr.type.conv#2], it does not cover this case
According to [dcl.init#general-14]
So, we will inspect [dcl.init.list] for this case. Meanwhile, [dcl.init.list#3.12] is also not suitable for this case
Since its condition is:
A prvalue of type
void
does not result in "initialization". So, it arguably says that such a corner case is not covered by the standard.The text was updated successfully, but these errors were encountered: