DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

Isaac S. spam-no-reply-isaac at outlook.com
Tue Nov 13 00:28:46 UTC 2018


On Tuesday, 13 November 2018 at 00:21:25 UTC, Neia Neutuladh 
wrote:
> On Tue, 13 Nov 2018 00:08:04 +0000, Isaac S. wrote:
>> If you really want this plaque in the language, at least make 
>> it not affect those that gave their enum a type. If you at 
>> least do that, someone can add it to DScanner to tell anyone 
>> that doesn't type their enum to expect illogical behavior.
>
> Unfortunately, dscanner only parses code. It can't tell you 
> that your overload resolution depends on value range 
> propagation on an enum value; that depends on semantic 
> analysis. So it would have to aggressively warn you against 
> using `enum Foo : some_int_type`.

Sorry if it wasn't clear, I meant that if `enum Foo : 
some_int_type` makes it so some_int_type is preferred (because 
it's a more direct conversion) DScanner could warn anyone that 
just does `enum Foo`.


More information about the Digitalmars-d-announce mailing list