[Issue 14340] AssertError in std.algorithm.sorting: unstable sort fails to sort an array with a custom predicate

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14340

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||and...@erdani.com
 Resolution|--- |INVALID

--- Comment #9 from Andrei Alexandrescu  ---
I'll close this. There is no guarantee we offer that the array being sorted has
the same content at all times when the predicate is being used.

--


[Issue 15257] New: __traits(compiles, …) with malformed inline asm silently ends compilation

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15257

  Issue ID: 15257
   Summary: __traits(compiles, …) with malformed inline asm
silently ends compilation
   Product: D
   Version: D2
  Hardware: x86
OS: Windows
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: cauter...@gmail.com

https://ideone.com/5tn592

When DMD hits this:
__traits(compiles, {
asm {#$%^&*;}
});
it runs asmerr(…) which is supposed to print the error ( verror(…) ) and
exit().
However, because __traits(compiles sets global.gag to 1, verror never prints
anything, so the compiler exits with no error message whatsoever.

--


[Issue 14327] Unhandled exception from writeln() in C++/D application

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14327

--- Comment #14 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/druntime

https://github.com/D-Programming-Language/druntime/commit/848c97c52186934dae807e2b0923c8fbb0f17e15
issue 14327: move call to init_msvc() into rt_init()

https://github.com/D-Programming-Language/druntime/commit/1c95b5827012f448d2d917c98dd310ac211dec69
Merge pull request #1412 from rainers/issue_14327

issue 14327: move call to init_msvc() into rt_init()

--


[Issue 15257] __traits(compiles, …) with malformed inline asm silently ends compilation

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15257

Cauterite  changed:

   What|Removed |Added

   Keywords||iasm

--


[Issue 14327] Unhandled exception from writeln() in C++/D application

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14327

--- Comment #15 from github-bugzi...@puremagic.com ---
Commit pushed to stable at https://github.com/D-Programming-Language/druntime

https://github.com/D-Programming-Language/druntime/commit/de2788d911129545531e0e42d1c8630b3f406e7c
Merge pull request #1412 from rainers/issue_14327

issue 14327: move call to init_msvc() into rt_init()

--


[Issue 15227] std.format undocumented grammar

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15227

--- Comment #2 from Jack Stouffer  ---
In addition to the above problems, the examples in text should be moved to unit
test examples.

--


[Issue 12624] Internal error: backend\cgobj.c 2313 with Rebindable!(immutable TimeZone) in std.datetime

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12624

Cauterite  changed:

   What|Removed |Added

   Keywords|iasm|
   Assignee|cauter...@gmail.com |nob...@puremagic.com

--


[Issue 15258] New: Anonymous const union members don't allow for initialization

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15258

  Issue ID: 15258
   Summary: Anonymous const union members don't allow for
initialization
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: a...@statystyka.net

The following code doesn't compile:

class A {
this(const char* result)
{
this.result = result;
}

private:
union{
const char** results;
const char* result;
}
}

Compilation fails with "constructor app.A.this missing initializer for const
field results". I know I can make it compile if I remove the const qualifier in
the union definition, but this is a poor walkaround. 

There are two better walkarounds:

1. Change the constructor body into 
{
this.results = null;
this.result = result;
}

2. Make the union named:

class A {
this(const char* result)
{
this.u.result = result;
}

private:
union U{
const char** results;
const char* result;
}
U u;
}

--


[Issue 15258] Anonymous const union members don't allow for initialization

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15258

--- Comment #1 from Adam Ryczkowski  ---
The issue is also discussed at Stackoverflow:
http://stackoverflow.com/questions/33415489

--


[Issue 15259] New: D_InlineAsm_X86_Any

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15259

  Issue ID: 15259
   Summary: D_InlineAsm_X86_Any
   Product: D
   Version: D2
  Hardware: x86_64
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: alil...@gmail.com

I've found it's quite common to need a version define which is on when any of
D_InlineAsm_X86 or D_InlineAsm_X86_64 is implemented.

Could be a welcome builtin version.

--


[Issue 15259] D_InlineAsm_X86_Any as builtin

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15259

ponce  changed:

   What|Removed |Added

Summary|D_InlineAsm_X86_Any |D_InlineAsm_X86_Any as
   ||builtin

--


[Issue 15262] New: [dmd-internal] Duplicated initialization in Token struct static constructor

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15262

  Issue ID: 15262
   Summary: [dmd-internal] Duplicated initialization in Token
struct static constructor
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: trivial
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: k.hara...@gmail.com

In tokens.d:

extern (C++) struct Token
{
...
static this()
{
...
Token.tochars[TOKandass] = "&=";
Token.tochars[TOKorass] = "|="; // <- initialization
Token.tochars[TOKcatass] = "~=";
...
Token.tochars[TOKnotidentity] = "!is";
Token.tochars[TOKorass] = "|="; // <- duplicated
Token.tochars[TOKidentifier] = "identifier";
...
}
}

--


[Issue 15260] New: [dmd-internal] StringExp.compare may cause memory invalid memory access

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15260

  Issue ID: 15260
   Summary: [dmd-internal] StringExp.compare may cause memory
invalid memory access
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Keywords: ice
  Severity: critical
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: k.hara...@gmail.com

>From the StringExp.compare code:

override int compare(RootObject obj)
{
...
if (len1 == len2)
{
switch (sz)
{
case 1:
return memcmp(cast(char*)string, cast(char*)se2.string, len1);
case 2:
{
wchar* s1 = cast(wchar*)string;
wchar* s2 = cast(wchar*)se2.string;
for (size_t u = 0; u < len; u++)
{
if (s1[u] != s2[u])
return s1[u] - s2[u];
}
}
// <--- should break here!
case 4:
// if len1 % 4 == 2, following memory read
// would access out of boundaries.
{
dchar* s1 = cast(dchar*)string;
dchar* s2 = cast(dchar*)se2.string;
for (size_t u = 0; u < len; u++)
{
if (s1[u] != s2[u])
return s1[u] - s2[u];
}
}
break;
default:
assert(0);
}
}
return cast(int)(len1 - len2);
}

--


[Issue 15256] New: Data races with arrays allowed in @safe code

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15256

  Issue ID: 15256
   Summary: Data races with arrays allowed in @safe code
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Keywords: accepts-invalid, safe
  Severity: critical
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: dfj1es...@sneakemail.com

@safe:
shared string s;
void f() @safe
{
s="s";
}

A slice is stored with two mov instructions, so when the global variable is
modified concurrently, it can end up with pointer from one array and length
from another.

--


[Issue 15253] [REG2.069.0-rc1] inliner prevent compilation

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15253

Martin Nowak  changed:

   What|Removed |Added

 CC||c...@dawg.eu

--- Comment #3 from Martin Nowak  ---
Seems to infinitely loop in InlineScanVisitor::inlineScan.

--


[Issue 15168] [REG2.068.0] std.variant.Algebraic interacts badly with string alias this sub-types

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15168

--- Comment #8 from github-bugzi...@puremagic.com ---
Commits pushed to stable at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/17af3b3014c625b23619fed11b68bbeb62b06e2c
fix Issue 15168 - ReplaceType broken for string sub-types

https://github.com/D-Programming-Language/phobos/commit/474eaff973887b8cce46b3440a1d6fd9426a4558
Merge pull request #3779 from MartinNowak/fix15168

fix Issue 15168 - ReplaceType broken for string sub-types

--


[Issue 15253] [REG2.069.0-rc1] inliner prevent compilation

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15253

Kenji Hara  changed:

   What|Removed |Added

   Keywords||ice, pull
   Hardware|x86_64  |All
 OS|Linux   |All

--- Comment #5 from Kenji Hara  ---
https://github.com/D-Programming-Language/dmd/pull/5241

--


[Issue 15261] New: [dmd-internal] Trivial problem in BinExp.checkOpAssignTypes

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15261

  Issue ID: 15261
   Summary: [dmd-internal] Trivial problem in
BinExp.checkOpAssignTypes
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: minor
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: k.hara...@gmail.com

In BinExp.checkOpAssignTypes:

if (op == TOKmulass ||
op == TOKdivass ||
op == TOKmodass ||
TOKaddass ||// TOK enum is used as a boolean value!
op == TOKminass ||
op == TOKpowass)
{
if ((type.isintegral() && t2.isfloating()))
{
warning("%s %s %s is performing truncating conversion",
type.toChars(), Token.toChars(op), t2.toChars());
}
}

But this is not a real problem, because:

1. checkOpAssignTypes is called only from BinAssignExp.semantic

2. BinAssignExp.semantic is used by these concrete classes derived from
BinAssignExp:

   (Add|Min|Mul|Div|Mod|Pow)AssignExp
   (And|Or|Xor)AssignExp
   (Shl|Shr|Ushr)AssignExp

3. However, BinAssignExp.e2.type can have floating point type only in:

   (Add|Min|Mul|Div|Mod|Pow)AssignExp

   Other cases are rejected before the call of checkOpAssignTypes in
BinAssignExp.semantic.

   Test case (compile with -o- -w):

void main()
{
int x;
double y;

x += y; // AddAssignExp  -> warning, expected
x -= y; // MinAssignExp  -> warning, expected
x *= y; // MulAssignExp  -> warning, expected
x /= y; // DivAssignExp  -> warning, expected
x %= y; // ModAssignExp  -> warning, expected
x ^^= y;// PowAssignExp  -> warning, expected

x &= y; // AndAssignExp  -> error, does not reach to
checkOpAssignTypes call
x |= y; // OrAssignExp   -> error, ditto
x ^= y; // XorAssignExp  -> error, ditto
x <<= y;// ShlAssignExp  -> error, ditto
x >>= y;// ShrAssignExp  -> error, ditto
x >>>= y;   // UshrAssignExp -> error, ditto
}

--


[Issue 15260] [dmd-internal] StringExp.compare may cause invalid memory access

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15260

Kenji Hara  changed:

   What|Removed |Added

Summary|[dmd-internal]  |[dmd-internal]
   |StringExp.compare may cause |StringExp.compare may cause
   |memory invalid memory   |invalid memory access
   |access  |

--


[Issue 15262] [dmd-internal] Duplicated initialization in Token struct static constructor

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15262

Kenji Hara  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #1 from Kenji Hara  ---
https://github.com/D-Programming-Language/dmd/pull/5240

--


[Issue 15261] [dmd-internal] Trivial problem in BinExp.checkOpAssignTypes

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15261

Kenji Hara  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #1 from Kenji Hara  ---
https://github.com/D-Programming-Language/dmd/pull/5240

--


[Issue 15260] [dmd-internal] StringExp.compare may cause memory invalid memory access

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15260

Kenji Hara  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #1 from Kenji Hara  ---
https://github.com/D-Programming-Language/dmd/pull/5240

--


[Issue 15263] Cannot insert range into DList

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15263

r...@rcorre.net changed:

   What|Removed |Added

 CC||r...@rcorre.net

--


[Issue 15263] New: Cannot insert range into DList

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15263

  Issue ID: 15263
   Summary: Cannot insert range into DList
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: major
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: r...@rcorre.net

import std.range, std.container;

unittest {
  auto r = iota(0,5);
  SList!int slist;
  DList!int dlist;

  slist.insert(r); // passes
  dlist.insert(r); // fails
}

You can insert a range into an SList, but not a DList.

usr/include/dlang/dmd/std/container/dlist.d(683): Error: template
std.container.dlist.DList!int.DList.createNode cannot deduce function from
argument types !()(int), candidates are:
/usr/include/dlang/dmd/std/container/dlist.d(166):   
std.container.dlist.DList!int.DList.createNode(Stuff)(ref Stuff arg, BaseNode*
prev = null, BaseNode* next = null)
/usr/include/dlang/dmd/std/container/dlist.d(688): Error: template
std.container.dlist.DList!int.DList.createNode cannot deduce function from
argument types !()(int, BaseNode*), candidates are:
/usr/include/dlang/dmd/std/container/dlist.d(166):   
std.container.dlist.DList!int.DList.createNode(Stuff)(ref Stuff arg, BaseNode*
prev = null, BaseNode* next = null)
/usr/include/dlang/dmd/std/container/dlist.d(653): Error: template instance
std.container.dlist.DList!int.DList.createRange!(Result) error instantiating
/usr/include/dlang/dmd/std/container/dlist.d(414):instantiated from
here: insertBeforeNode!(Result)
phobos_dlist_bug.d(9):instantiated from here: insertBack!(Result)
Failed: ["dmd", "-Isrc", "-main", "-unittest", "-debug", "-g", "-v", "-o-",
"phobos_dlist_bug.d", "-I."]

--


[Issue 15264] New: opDispatch cannot implement range primitives

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15264

  Issue ID: 15264
   Summary: opDispatch cannot implement range primitives
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: druntime
  Assignee: nob...@puremagic.com
  Reporter: r...@rcorre.net

If you use opDispatch to implement range primitives, isInputRange passes yet it
cannot be used in foreach loops:

---
import std.range;

struct R {
  auto vals = iota(0, 5);
  auto opDispatch(string s)() { return mixin("vals."~s); }

  // uncomment to pass:
  //auto front() { return vals.front; }
  //auto popFront() { return vals.popFront; }
  //auto empty() { return vals.empty; }
}

// R is an input range, but cannot be used in foreach:
static assert(isInputRange!R);   // pass
static assert(__traits(compiles, { foreach(v ; R()) { } })); // fail
---

We either need to allow foreach via opDispatched range primitives or have
is*Range return false in this case.

Personally, I would like to see foreach work in this case, though there may be
concerns over 'accidental' range implementation:
http://forum.dlang.org/thread/tociqzmmryxyggzyp...@forum.dlang.org

--


[Issue 15264] opDispatch cannot implement range primitives

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15264

r...@rcorre.net changed:

   What|Removed |Added

 CC||r...@rcorre.net

--


[Issue 15253] [REG2.069.0-rc1] inliner prevent compilation

2015-10-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15253

--- Comment #4 from Kenji Hara  ---
(In reply to Martin Nowak from comment #3)
> Seems to infinitely loop in InlineScanVisitor::inlineScan.

The regression is introduced in:
https://github.com/D-Programming-Language/dmd/pull/5117

--