"Manuel López-Ibáñez" <lopezibanez@gmail.com> writes:
| :ADDPATCH c++:
|
| The error message for this code:
|
| void debug (const char * string)
| {
| return;
| }
|
| int f()
| {
| ( true == false ? 0 : debug ("Some string"));
| return 0;
| }
|
| is:
|
| error: debug(((const char*)"Some string")) has type void and is not a
| throw-expression
|
| The following patch changes the message to:
|
| error: 'debug(((const char*)"Some string"))' of type 'void' is
| incompatible with '0' of type 'int'
"incompatible" tends to have a precise meaning, especially when types
are involded.
The rule is: if one the operand is of type void, then the other
operand must be of type void or a throw expression -- but both cannot
be a throw-expression.
I would prefer the "improved" diagnostic to say something like
third operand to the conditional operator is of type 'void', but
the second operand is neither a throw-expression nor of type 'void'
and swap second/third the other around to cover the symmetric case.