DMD can implicitly convert class pointer to the bool. Is it bug or terrible feature?

Maxim Fomin maxim at maxim-fomin.ru
Sun Nov 24 08:04:20 PST 2013


On Sunday, 24 November 2013 at 15:55:25 UTC, ilya-stromberg wrote:
> On Sunday, 24 November 2013 at 15:39:20 UTC, Maxim Fomin wrote:
>
>> No way compiler could guess that you have bool f in mind.
>
> Sorry if I didn't explain the example properly.
>
> The `bool f` variable was in my code and it works correctly, 
> but compiler didn't put attention that I have identifiers 
> shadowing issue. After big code refactoring I wrongly commented 
> the `bool f` variable.

OK, root of the issue is identifier shadowing.

>
> So, nothing happens if compiler provides identifier shadowing 
> error - I'll just rename variable. Is it possible to implement?

Yes, it is possible, but AFAIK Walter is opposite because he 1) 
thinks shadowing is OK (and taking into account compability with 
C, this is dabatable), 2) does not like warnings.


More information about the Digitalmars-d mailing list