On Thu, 04 Jun 2009 13:10:58 -0500, Andrei Alexandrescu <[email protected]> wrote:
>Max Samukha wrote: >> On Thu, 04 Jun 2009 10:41:31 -0500, Andrei Alexandrescu >> <[email protected]> wrote: >> >> >>> You are mistakenly presupposing that if() takes a bool. In reality if() >>> accepts a bool, an integral, a floating-point type, a pointer, an array, >>> or a class reference. >> >> or delegate > >I was sure I forgot something... and hash too. Anything that can be >compared against 0 or null. > >Andrei Yeah. If anybody doesn't know, it works like this: IfStatement::semantic checks Expression::checkToBoolean, which for delete, assignment etc issues an error and for other expressions calls Type::checkBoolean, which for most types except arrays, class references etc. calls isscalar().
