Why does intpromote spew warnings for ~ operator?

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Sep 13 17:54:13 UTC 2021


On Mon, Sep 13, 2021 at 01:49:25PM -0400, Steven Schveighoffer via Digitalmars-d wrote:
> On 9/13/21 11:38 AM, H. S. Teoh wrote:
> > On Sun, Sep 12, 2021 at 10:14:03AM -0400, Steven Schveighoffer via Digitalmars-d wrote:
> > [...]
> > > ```
> > > onlineapp.d(11): Deprecation: integral promotion not done for `~x`, use
> > > '-preview=intpromote' switch or `~cast(int)(x)`
> > > onlineapp.d(11): Deprecation: integral promotion not done for `~x`, use
> > > '-preview=intpromote' switch or `~cast(int)(x)`
> > > Number of affected cases: 0
> > > ```
> > [...]
> > 
> > The integer promotion situation in D is a mess.  My personal
> > preference is:
> > 
> > --------
> > module nopromote;
> 
> Sure, just like *everyone* uses std.utf.byCodeUnit to avoid
> autodecoding, right?
[...]

It's a solution (or half-solution hack) that works today, as opposed to
a wishful solution that may or may not happen in the future, if ever.


T

-- 
Trying to define yourself is like trying to bite your own teeth. -- Alan Watts


More information about the Digitalmars-d mailing list