[Issue 1977] Relax warnings (D1)/errors (D2) for implicit narrowing conversions caused by promotions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 12 19:42:39 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=1977


Jonathan M Davis <jmdavisProg at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg at gmx.com


--- Comment #25 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-10-12 19:42:37 PDT ---
> trivially incorrect use of op assignment operator is allowed:

Your example is perfectly valid. D uses range value propagation:

http://www.drdobbs.com/tools/value-range-propagation/229300211

It knows the value of both x and y, so it knows that x |= y; will work just
fine, because all of the values will fit in the correct types. If the value in
y was too large to fit in a ushort, _then_ it should give you an error, but
since it fits in a ushort just fine (and is positive, so there's no issues with
two's complement or whatnot), the compiler knows that it's fine and allows it
without complaint.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list