This is a follow-up up of this question.
In the comments and in the answer it is said more than once that void{}
is neither a valid type-id nor a valid expression.
That was fine, it made sense and that was all.
Then I came through [7.1.7.4.1/2] (placeholder type deduction) of the working draft.
There it is said that:
[...]
- for a non-discardedreturn
statement that occurs in a function declared with a return type that contains a placeholder type,T
is the declared return type ande
is the operand of thereturn
statement. If thereturn
statement has no operand, thene
isvoid{}
;
[...]
So, is void{}
(conceptually) legal or not?
If it's acceptable as mentioned in the working draft (even though only as an - as if it's a - statement), it must be legal indeed. This means that decltype(void{})
should be valid as well, as an example.
Otherwise, should the working draft use void()
instead of void{}
?
Well, to be honest, I'm quite sure I'm not skilled enough to point out an error in the working draft, so the real question is: what 's wrong in my reasoning?
What's exactly the void{}
mentioned in the bullet above and why it's a legal expression in this case?