[Issue 1077] writef and friends won't read/write from/to redirected std handles

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1077

Berni  changed:

   What|Removed |Added

 CC|dl...@croco-puzzle.com  |

--


[Issue 20205] std.math: Wrong result for abs(int.min)

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20205

Dlang Bot  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Dlang Bot  ---
dlang/phobos pull request #7182 "Fix issue 20205 - std.math: Wrong result for
abs(int.min)" was merged into master:

- e6b5c68b4b76d637c8754643d4d908fc57b41e70 by Berni:
  Fix issue 20205 - std.math: Wrong result for abs(int.min)

https://github.com/dlang/phobos/pull/7182

--


[Issue 17774] Please include implib in setup / 7z archive

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17774

Andre  changed:

   What|Removed |Added

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

--


[Issue 17774] Please include implib in setup / 7z archive

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17774

--- Comment #1 from Andre  ---
The default on Windows is now more or less Coff, either X86 or X86_64.
(Dub defaults to COFF).

Implib is written for OMF and therefore doesn't help much anymore. 
Therefore I close this issue.

--


[Issue 1077] writef and friends won't read/write from/to redirected std handles

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1077

Berni  changed:

   What|Removed |Added

 CC||dl...@croco-puzzle.com

--


[Issue 20205] std.math: Wrong result for abs(int.min)

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20205

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #5 from Dlang Bot  ---
@crocopaw created dlang/phobos pull request #7182 "Fix issue 20205 - std.math:
Wrong result for abs(int.min)" fixing this issue:

- Fix issue 20205 - std.math: Wrong result for abs(int.min)

https://github.com/dlang/phobos/pull/7182

--


[Issue 20209] New: AA.get() needs to work with inout correctly

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20209

  Issue ID: 20209
   Summary: AA.get() needs to work with inout correctly
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: druntime
  Assignee: nob...@puremagic.com
  Reporter: hst...@quickfur.ath.cx

Code:
--
struct C {
int[] data;
}
struct S {
private int[][string] aa;
inout(C) func(string key) inout {
return inout(C)(aa[key]);
}
inout(C) gunk(string key) inout {
return inout(C)(aa.get(key, [])); // line 10
}
}
--

Compiler output:
--
test.d(10): Error: cannot implicitly convert expression get(this.aa, key,
delegate const(int[])() pure nothrow @nogc @safe => []) of type const(int[]) to
inout(int[])
--

Expected behaviour: gunk() should compile, because it's doing nothing illegal:
it's looking up a key from S.aa and returning it, just like func() does, except
that gunk() uses aa.get() in order to provide a default value when the key
doesn't exist in the AA.

--


[Issue 20205] std.math: Wrong result for abs(int.min)

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20205

--- Comment #4 from Berni  ---
In the forums I found a workaround: (0-x) instead if -x. When the transition
has ended, this workaround can be removed. Unfortunatly I can't find anything
on this deprecation on https://dlang.org/deprecate.html

--


[Issue 20205] std.math: Wrong result for abs(int.min)

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20205

--- Comment #3 from Berni  ---
Having used Java for years unsigned integers often don't come to my mind...
It's a good idea to use them! :-)

But:

xmin.d(7): Deprecation: integral promotion not done for -x, use
'-transition=intpromote' switch or -cast(int)(x)

--


[Issue 20208] extern (C++) copy constructor bad mangling for dmd

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20208

kinke  changed:

   What|Removed |Added

 CC||ki...@gmx.net

--- Comment #3 from kinke  ---
We probably have to emit extern(C++) copy ctors as 2 symbols for non-Windows,
both the C1 ('complete object ctor') and the C2 ('base object constructor')
variant. There's even a third one, C3 ('complete object allocating
constructor'). A similar mess as for the C++ dtors.

The testcase in https://github.com/dlang/dmd/pull/9806 needed the C2 one, so I
assumed it would suffice, but it clearly doesn't: https://godbolt.org/z/qD5Tta

--


[Issue 2195] Variable shadowing in foreach is not detected and reported

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2195

Dlang Bot  changed:

   What|Removed |Added

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

--- Comment #11 from Dlang Bot  ---
dlang/dmd pull request #10404 "Fix Issue 2195 - Variable shadowing in foreach
is not detected and reported" was merged into master:

- 08399aa0858aa336bec632a8f4110c381c61ea4e by RazvanN7:
  Fix Issue 2195 - Variable shadowing in foreach is not detected and reported

https://github.com/dlang/dmd/pull/10404

--


[Issue 2193] Allow implicit conversions: char -> ubyte, wchar -> ushort, dchar -> uint

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2193

RazvanN  changed:

   What|Removed |Added

   Keywords||bootcamp
 CC||razvan.nitu1...@gmail.com

--


[Issue 20208] extern (C++) copy constructor bad mangling for dmd

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20208

RazvanN  changed:

   What|Removed |Added

 CC||razvan.nitu1...@gmail.com

--- Comment #2 from RazvanN  ---
It seems that this is the cause of your problems:
https://github.com/dlang/dmd/pull/9806

--


[Issue 20208] extern (C++) copy constructor bad mangling for dmd

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20208

--- Comment #1 from Eduard Staniloiu  ---
Forgot to mention.

I also tested with gdc-9 and everything works as expected (same result as with
ldc).

--


[Issue 20208] New: extern (C++) copy constructor bad mangling for dmd

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20208

  Issue ID: 20208
   Summary: extern (C++) copy constructor bad mangling for dmd
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: edi33...@gmail.com

DMD is incorrectly mangling the copy constructor of an `extern (C++) struct`.
Please see the details below

c.d
```
module c;

extern (C++) struct A
{
int x;
this(int x) { this.x = x; }
this(const ref A rhs) { this.x = rhs.x; }
~this() { }
}
```

c.h
```
struct A
{
_d_int x;
A(_d_int x);
A(const A& rhs);
~A();
};
```

tc.cpp
```
#include "c.h"  

int main(int argc, char *argv[])
{
A x = A(42);
A y = x;
return 0;
}
```

I'm running on Ubuntu 18.04.1 LTS

Compiling `.d` with DMD64 D Compiler v2.086.0-1241-g08360654e

custdmd2 -c -betterC c.d

Compiling `.cpp` with g++ (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0

g++ -c tc.cpp

Linking the two objects together

`g++ tc.o c.o` results in the linker error

tc.o: In function `main':
tc.cpp:(.text+0x3f): undefined reference to `A::A(A const&)'
collect2: error: ld returned 1 exit status

Results of `nm` on objects

nm c.o
[...]
 W _ZN1AC2ERKS_

nm tc.o
[...]
 U _ZN1AC1ERKS_

Compiling the `.d` module with LDC - the LLVM D compiler (1.14.0) based on DMD
v2.084.1 and LLVM 7.0.1

ldc2 -betterC -c c.d

The resulted `c.o` object correctly links with the g++ generated one.

The output of `nm c.o` on the ldc2 generated object is
[...]
 T _ZN1AC1ERKS_

--


[Issue 2195] Variable shadowing in foreach is not detected and reported

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2195

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #10 from Dlang Bot  ---
@RazvanN7 created dlang/dmd pull request #10404 "Fix Issue 2195 - Variable
shadowing in foreach is not detected and reported" fixing this issue:

- Fix Issue 2195 - Variable shadowing in foreach is not detected and reported

https://github.com/dlang/dmd/pull/10404

--


[Issue 20207] New: (inline asm) DMD (x64) assembles code that contains both REX and high byte of a general purpouse register

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20207

  Issue ID: 20207
   Summary: (inline asm) DMD (x64) assembles code that contains
both REX and high byte of a general purpouse register
   Product: D
   Version: D2
  Hardware: x86_64
OS: Windows
Status: NEW
  Severity: minor
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: eugenajechil...@gmail.com

The following code assembles: add R12B, AH.
When there is REX prefix, the high byte of the general purpouse registers can't
be used, so this should not assemble.
As expected, the instruction above actually does -- add R12B, SPL -- (adding
SPL instead of AH).

--


[Issue 20206] New: potential bug in complex power operator

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20206

  Issue ID: 20206
   Summary: potential bug in complex power operator
   Product: D
   Version: D2
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: dl...@croco-puzzle.com

During Phobos PR #7173, all 32bit machines failed in a unittest for the complex
power operator, while all 64bit machines did not. This might be due to a bug in
complex ^^.

The following program will probably reproduce the error, but I had no
opportunity to check this, because I did not succeed in installing dmd on my
old 32bit machine. (Got segmentation fault, whenever I started dmd. I think, a
library is missing. ldc2 complained about not finding gcc, although being
installed and in $PATH. And gdc did not reproduce the error, but used an older
version of phobos.)

void main()
{
import std.complex;

auto rec3a = 0.79 ^^ complex(6.8, 5.7);
auto rec3b = complex(0.79, 0.0) ^^ complex(6.8, 5.7);

assert(approxEqual(rec3a.re, rec3b.re, double.epsilon));
}

bool approxEqual(T, U, V)(T lhs, U rhs, V maxRelDiff = 1e-9, V maxAbsDiff = 0)
{
import std.traits:isIntegral;
import std.math:fabs;

if (isIntegral!T || isIntegral!U)
{
return approxEqual(real(lhs), real(rhs), maxRelDiff, maxAbsDiff);
}

if (lhs == rhs) return true;

static if (is(typeof(lhs.infinity)) && is(typeof(rhs.infinity)))
{
if (lhs == lhs.infinity || rhs == rhs.infinity ||
lhs == -lhs.infinity || rhs == -rhs.infinity) return false;
}

auto diff = fabs(lhs - rhs);

return diff <= maxRelDiff*fabs(lhs) || diff <= maxRelDiff*fabs(rhs) || diff
<= maxAbsDiff;
}

--


[Issue 20205] std.math: Wrong result for abs(int.min)

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20205

--- Comment #2 from Dominikus Dittes Scherkl  ---
unittest
{
   byte a = -128;
   auto b = abs(a);
   assert(is(typeof(b) == ubyte));
   assert(b == 128);
}

--


[Issue 20205] std.math: Wrong result for abs(int.min)

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20205

Dominikus Dittes Scherkl  changed:

   What|Removed |Added

 CC||domini...@scherkl.de

--- Comment #1 from Dominikus Dittes Scherkl  ---
Use better implementation of abs:

/// get the absolute value of x as unsigned type. always succeeds, even for
T.min
Unsigned!T abs(T)(const(T) x) if(isIntegral!T)
{
   static if(isSigned!T) if(x < 0) return -x;
   return x;
}

--


[Issue 4455] Taking the sqrt of an integer shouldn't require an explicit cast.

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4455

Berni  changed:

   What|Removed |Added

   Hardware|Other   |All
 OS|Windows |All

--


[Issue 4455] Taking the sqrt of an integer shouldn't require an explicit cast.

2019-09-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4455

Berni  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 CC||dl...@croco-puzzle.com
 Resolution|FIXED   |---

--- Comment #3 from Berni  ---
Still there, or crept in again.

--