D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21279 - cast expression between integer types is not defined
Summary: cast expression between integer types is not defined
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dlang.org (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: pull, spec
: 20708 (view as issue list)
Depends on:
Blocks:
 
Reported: 2020-09-25 20:02 UTC by Steven Schveighoffer
Modified: 2022-08-26 08:01 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Steven Schveighoffer 2020-09-25 20:02:27 UTC
It was pointed out to me that there is nothing in the spect that defines casting between integer types of different sizes.

For example:

auto x = cast(int)long.max;

There is nothing in the spec that says what should happen here. Of course, we all know what it should and does do. It should be spelled out.

Also I cannot find "Value Range Propagation" anywhere in the spec. Somewhat related.
Comment 1 Dlang Bot 2022-08-15 13:13:33 UTC
@ntrel created dlang/dlang.org pull request #3373 "Fix Issue 21279 - cast expression between integer types is not defined" fixing this issue:

- Fix Issue 21279 - cast expression between integer types is not defined

https://github.com/dlang/dlang.org/pull/3373
Comment 2 Nick Treleaven 2022-08-15 13:17:00 UTC
*** Issue 20708 has been marked as a duplicate of this issue. ***
Comment 3 Dlang Bot 2022-08-26 08:01:49 UTC
dlang/dlang.org pull request #3373 "Fix Issue 21279 - cast expression between integer types is not defined" was merged into master:

- b3b668f37ead8536d8ff81ff40caf34e3f05a4a5 by Nick Treleaven:
  Fix Issue 21279 - cast expression between integer types is not defined

https://github.com/dlang/dlang.org/pull/3373