Steven Watanabe wrote:
AMDG
Tobias Schwinger
writes: As pointed out in other posts I think the default default case behavior should be changed not to throw but to use the default constructor if no default case function object is specified.
Will do.
A default case function object returning 'void' should be assumed (and 'assert'ed) not to return in a context where a (non-void) result is expected (implementation hint: the built-in comma operator allows void arguments and an overloaded comma operator doesn't).
Personally, I'd rather just forbid a default that returns void when the return type is non-void.
The rationale was to allow non-returning default function objects that work regardless of the type (such as 'throw_'). It's probably not that important...
I don't think the comma operator is a completely fool-proof way to detect void.
It is.
It could cause an ambiguity if the other type also defines an overloaded comma operator.
No, because the operator is binary and one operand can have a reserved type which is only internally used by the test code. Regards, Tobias