[Issue 17149] to!int("42", 16, LetterCase.lower) does not compile

2017-02-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17149

b2.t...@gmx.com changed:

   What|Removed |Added

 CC||b2.t...@gmx.com

--- Comment #1 from b2.t...@gmx.com ---
The letter case is only interesting in the "int2string" way. I don't see the
point of allowing it as parameter in the "string2int" way. The "string2int" way
handles mixed lower and upper case.

void main()
{
import std.ascii;
import std.conv;
assert(to!int("AbCde", 16) == 0xabcde);
assert(to!int("aBcdE", 16) == 0xabcde);
}

--


[Issue 17149] New: to!int("42", 16, LetterCase.lower) does not compile

2017-02-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17149

  Issue ID: 17149
   Summary: to!int("42", 16, LetterCase.lower) does not compile
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: issues.dl...@jmdavisprog.com

This code does not compile. 

void main()
{
import std.ascii;
import std.conv;
assert(to!int("42", 16) == 0x42);
assert(to!int("42", 16, LetterCase.lower) == 0x42);
assert(to!int("42", 16, LetterCase.upper) == 0x42);
}

The first to!int call works, but the other two do not. It is clear from the
documentation for std.conv.to that they should. And std.conv.to has this in its
unit tests:

assert(to!string(Int(0x1234BCD), 16u, LetterCase.upper) == "1234BCD");
assert(to!string(Int(0x1234AF), 16u, LetterCase.lower) == "1234af");

So, the problem is likely related to access levels in some way, with required
functions probably being private. Regardless, the results is that you can't
currently give std.conv.to!int a LetterCase argument, forcing all hex literals
to be uppercase. It wouldn't surprise me if this is a regression, but I'm not
in a good position to test that at the moment.

--


[Issue 16255] std.algorithm.iteration.each on opApply doesn't support ref

2017-02-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16255

b2.t...@gmx.com changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 CC||b2.t...@gmx.com
 Resolution|FIXED   |---

--- Comment #6 from b2.t...@gmx.com ---
Is this supposed to work now ?


void main()
{
int[][] arr = void;
arr.length = 10;

version(all)
{
import std.algorithm.iteration : each;
arr.each!((ref a){a.length = 10; a[] = -1;});
}
else
{
foreach(ref a; arr)
{
a.length = 10;
a[] = -1;
}
}
}

--


[Issue 8471] std.stdio.readf should be @trusted

2017-02-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=8471

Jakub Łabaj  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #15 from Jakub Łabaj  ---
It's not fixed yet, my commit doesn't really make readf @safe/@trusted (sorry
for the mess).

--


[Issue 17148] implicit conversion to void[] breaks type system

2017-02-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17148

anonymous4  changed:

   What|Removed |Added

Summary|implicit conversion to  |implicit conversion to
   |void[] violates type system |void[] breaks type system

--


[Issue 17148] implicit conversion to void[] violates type system

2017-02-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17148

anonymous4  changed:

   What|Removed |Added

   Keywords||accepts-invalid
   See Also||https://issues.dlang.org/sh
   ||ow_bug.cgi?id=2095,
   ||https://issues.dlang.org/sh
   ||ow_bug.cgi?id=12560

--


[Issue 2095] covariance w/o typechecks = bugs

2017-02-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2095

anonymous4  changed:

   What|Removed |Added

   See Also||https://issues.dlang.org/sh
   ||ow_bug.cgi?id=17148

--


[Issue 12560] [CTFE] Accepts invalid array assign of void[], breaks type system

2017-02-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12560

anonymous4  changed:

   What|Removed |Added

   See Also||https://issues.dlang.org/sh
   ||ow_bug.cgi?id=17148

--


[Issue 17148] New: implicit conversion to void[] violates type system

2017-02-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17148

  Issue ID: 17148
   Summary: implicit conversion to void[] violates type system
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: major
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: dfj1es...@sneakemail.com

void f(int*[] a, const int*[] b)
{
void[] a1=a;
const void[] b1=b;
a1[]=b1[];
*a[0]=0; //modify const data
}

Probably void[] shouldn't be writable without an explicit cast to, say, byte[].
Pretty similar to issue 2095: cast to void[] here is an upcast and should add
const qualifier. If the data was allocated as void[] from the beginning, then
it may be writable.

--