[Issue 18755] New: std.typecons.Rebindable breaks @safe-ty

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

  Issue ID: 18755
   Summary: std.typecons.Rebindable breaks @safe-ty
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Keywords: safe
  Severity: critical
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: c...@klickverbot.at

This compiles and runs with DMD 2.079:

---
class Foo {
auto opCast(T)() @system immutable pure nothrow {
*(cast(uint*)0xdeadbeef) = 0xcafebabe;
return T.init;
}
}

void main() @safe {
import std.typecons;
auto r = Rebindable!(immutable Foo)(new Foo); // oops
}
---

--


[Issue 18751] chunkBy predicate cannot access local variable

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

hst...@quickfur.ath.cx changed:

   What|Removed |Added

   Keywords|pull|
  Component|phobos  |dmd

--- Comment #3 from hst...@quickfur.ath.cx ---
PR has been closed, as it has been decided this needs to be addressed in the
compiler rather than the library.

--


[Issue 16206] traits getOverloads fails when one of the overload is a templatized function

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

johanenge...@weka.io changed:

   What|Removed |Added

   Keywords||industry
 CC||johanenge...@weka.io

--


[Issue 7443] Better diagnostic on wrongly written static constructor

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

RazvanN  changed:

   What|Removed |Added

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

--- Comment #2 from RazvanN  ---
PR : https://github.com/dlang/dmd/pull/8164

--


[Issue 18712] [Reg 2.072] bogus "switch skips declaration" error with case in mixin

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

--- Comment #2 from Martin Nowak  ---
Also see issue 16254

--


[Issue 18712] [Reg 2.072] bogus "switch skips declaration" error with case in mixin

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

Martin Nowak  changed:

   What|Removed |Added

 CC||c...@dawg.eu
Summary|bogus "switch skips |[Reg 2.072] bogus "switch
   |declaration" error with |skips declaration" error
   |case in mixin   |with case in mixin
 OS|Windows |All

--- Comment #1 from Martin Nowak  ---
Digger says https://github.com/dlang/dmd/pull/5869.

And btw yes, deprecation warnings should be deduplicated before printing, maybe
simply by hashing the error and the source code location.

--


[Issue 14909] Template argument of std.algorithm.iteration.chunkBy cannot access a local variable

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

Seb  changed:

   What|Removed |Added

 CC||greensunn...@gmail.com
Summary|Template argument of|Template argument of
   |std.algoirthm.iteration.chu |std.algorithm.iteration.chu
   |nkBy cannot access a local  |nkBy cannot access a local
   |variable|variable

--


[Issue 18753] chunkBy compile error causes ICE

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

--- Comment #1 from RazvanN  ---
PR : https://github.com/dlang/dmd/pull/8161

--


[Issue 18753] chunkBy compile error causes ICE

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

RazvanN  changed:

   What|Removed |Added

 CC||razvan.nitu1...@gmail.com
   Assignee|nob...@puremagic.com|razvan.nitu1...@gmail.com

--


[Issue 18698] static foreach + __traits(allMembers, moduleName)

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

Simen Kjaeraas  changed:

   What|Removed |Added

 CC||simen.kja...@gmail.com

--- Comment #17 from Simen Kjaeraas  ---
As a workaround for now, you can use a string mixin:


import std.conv : to;
string create() {
string s = "";
static foreach (i, e; __traits(allMembers, mixin(__MODULE__))) {
s ~= "int n"~i.to!string~";";
}
return s;
}
mixin(create());
pragma(msg, __traits(allMembers, mixin(__MODULE__))); // tuple("object",
"create", "n0", "n1")


The root cause is, as Ketmar pointed out in comment #2, that
__traits(allMembers) tries to expand the static foreach, and the static foreach
calls __traits(allMembers), leading to unbounded mutual recursion and
eventually a stack overflow. The exact same issue occurs if a template mixin in
used in place of the string mixin in the above example.

This makes some sense - how can you iterate over all members when the list
isn't complete yet? For the sake of pragmatism though, it's probably sensible
to allow iteration of the incomplete list, and certainly having the compiler
crash is less than optimal.

--