bool t; t= true+false; // this accepted t= true+true; // Error: cannot implicitly convert expression (2) of type int to bool bool type shouldn't be addable. and error message is confusing.
bool follows the same integral promotion rules that C has, and this is working as designed. I also do not understand why the error message is confusing - 2 cannot be implicitly converted to bool, as it says.
I think the confusion comes from the cast failure being value dependent rather than just type dependent.
I don't think we still need to keep consistent with C on that exactly point. Compiler can at least giving a waring on this. And adding code to BinExp::semantic , and provide a table like implicitconv table [op, e1->type, e2->type] mapping to bin op allow for TOK.TOKadd, bool, bool -> false TOK.TOKmul, bool, bool -> false and this naturally fix issue 1511
The error message looks clear. And and this point I don't think D boolean semantics will change. So I think this bug report needs to be closed.
I tend to agree.