[Issue 10560] Enum typed as int with value equal to 0 or 1 prefer bool over int overload

2018-11-11 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10560

Walter Bright  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution|--- |INVALID

--- Comment #4 from Walter Bright  ---
Rejected for same reason as https://issues.dlang.org/show_bug.cgi?id=

--


[Issue 9999] Integer literal 0 and 1 should prefer integer type in overload resolution

2018-11-11 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=

Walter Bright  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--- Comment #17 from Walter Bright  ---
These behaviors in D make sense if one considers a 'bool' to be an integer type
that is one bit in size. There are no special conversion rules in D for bool,
it behaves just like short, int, long, etc.

For example:

In the initialization `integral_type x = ct;`, whenever
`integral_type` is wide enough to fit constant `ct`, the constant can
be used for initialization even though its ostensible type is not the
same as `integral_type`.

This is a nice successful rule in D, without which we'd need to write
nonsense like:

ubyte x = cast(ubyte) 100;

As for overloading, D chooses the tightest conversion when choosing an
overload. This is somewhat surprising, but consistent across bool,
ubyte, and all other integral types. Again, there is no special rule for bool.

Marking as invalid.

--


[Issue 19391] [ICE] static array comparison

2018-11-11 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19391

Nicholas Wilson  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code

--


[Issue 19391] New: [ICE] static array comparison

2018-11-11 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19391

  Issue ID: 19391
   Summary: [ICE] static array comparison
   Product: D
   Version: D2
  Hardware: x86
OS: All
Status: NEW
  Severity: regression
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: iamthewilsona...@hotmail.com

see this commit[1] which worked around it

[1]:https://github.com/libmir/mir-algorithm/commit/c804962c99467168484dbf084bbe491bcd2da2a7

---
auto slice = iota(2, 3).universal.assumeContiguous;
...
- assert(slice._strides == []); // <<< Crashes
+ static assert(slice._strides.length == 0); // the workaround
---

slice._strides is an alias to the second member of a tuple, which somehow ends
up wrongly having the type const(long[1]) outside of CTFE (since the static
assert passes) which when compared for equality to [] (which is inferred as
long[0]) fails in e2ir.d when DMD tries to optimise the comparison to a memcmp
because the size of the two arrays do not match, tripping an assert[2]
assert(t1.size() == t2.size()); where t1,t2 are the type of the static arrays.

[2]: https://github.com/dlang/dmd/blob/master/src/dmd/e2ir.d#L2436

--