[Issue 22105] std.container.array.Array.length setter creates values of init-less types
https://issues.dlang.org/show_bug.cgi?id=22105 Dlang Bot changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #2 from Dlang Bot --- dlang/phobos pull request #8344 "Fix Issue 22105 - std.container.array.Array.length setter creates val…" was merged into master: - 7b863cadab53e1c4ddbab296787372d4d2a1 by wolframw: Fix Issue 22105 - std.container.array.Array.length setter creates values of init-less types https://github.com/dlang/phobos/pull/8344 --
[Issue 22105] std.container.array.Array.length setter creates values of init-less types
https://issues.dlang.org/show_bug.cgi?id=22105 Dlang Bot changed: What|Removed |Added Keywords||pull --- Comment #1 from Dlang Bot --- @wolframw created dlang/phobos pull request #8344 "Fix Issue 22105 - std.container.array.Array.length setter creates val…" fixing this issue: - Fix Issue 22105 - std.container.array.Array.length setter creates values of init-less types https://github.com/dlang/phobos/pull/8344 --
[Issue 18026] Stack overflow in ddmd/dtemplate.d:6241, TemplateInstance::needsCodegen()
https://issues.dlang.org/show_bug.cgi?id=18026 Tim changed: What|Removed |Added CC||tim.dl...@t-online.de --- Comment #20 from Tim --- I have also seen a stack overflow with TemplateInstance.needsCodegen and reduced it to the following code: bool f(T)(T x) { return false; } static foreach(i; 0..6) { static if(f(i)) { } } The failure happens on Windows. It can also be reproduced on Linux by increasing the number of iterations or reducing the stack size first with the command "ulimit -s 1024" --
[Issue 22634] assert for too many symbols should be error
https://issues.dlang.org/show_bug.cgi?id=22634 Dlang Bot changed: What|Removed |Added Keywords||pull --- Comment #1 from Dlang Bot --- @tim-dlang created dlang/dmd pull request #13467 "Fix issue 22634 - assert for too many symbols should be error" fixing this issue: - Fix issue 22634 - assert for too many symbols should be error https://github.com/dlang/dmd/pull/13467 --
[Issue 22634] New: assert for too many symbols should be error
https://issues.dlang.org/show_bug.cgi?id=22634 Issue ID: 22634 Summary: assert for too many symbols should be error Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: tim.dl...@t-online.de void main() { static foreach(i; 0..65537) { } } The above code triggers an assert in src/dmd/expressionsem.d: assert(s.localNum); // 65535 should be enough for anyone I found it while reducing a different problem, so it may not be a problem in real code, but it should be a normal error instead of an assert. --
[Issue 22633] Associative array require and update don't work if the value type can't be reassigned or copied.
https://issues.dlang.org/show_bug.cgi?id=22633 thomas.bock...@gmail.com changed: What|Removed |Added Keywords||rejects-valid --
[Issue 22633] New: Associative array require and update don't work if the value type can't be reassigned or copied.
https://issues.dlang.org/show_bug.cgi?id=22633 Issue ID: 22633 Summary: Associative array require and update don't work if the value type can't be reassigned or copied. Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: druntime Assignee: nob...@puremagic.com Reporter: thomas.bock...@gmail.com The program below should work, but instead fails to compile with various errors of the form: Error: cannot modify struct instance `*p` of type `S` because it contains `const` or `immutable` members /// module app; import std.stdio : writeln; struct S { const(int) a; } void main() @safe { S[string] aa; aa.require("x", S(1)); writeln(aa["x"]); aa.update("y", () => S(2), (ref const(S)) { }); writeln(aa["y"]); } /// The cause of the error is that object.require and object.update both use assignment for initialization, even though it is known at compile time that the target is new and has not yet been constructed. The fix is to use core.lifetime.moveEmplace for initialization, instead: /// ref V require(K, V)(ref V[K] aa, K key, lazy V value = V.init) { bool found; // if key is @safe-ly copyable, `require` can infer @safe static if (isSafeCopyable!K) { auto p = () @trusted { return cast(V*) _aaGetX(cast(AA*) , typeid(V[K]), V.sizeof, , found); } (); } else { auto p = cast(V*) _aaGetX(cast(AA*) , typeid(V[K]), V.sizeof, , found); } if (found) return *p; else { import core.internal.traits : hasElaborateMove; static if(hasElaborateMove!V) () @system { } (); (V value) @trusted { import core.lifetime : moveEmplace; moveEmplace(value, *p); } (value()); return *p; // this might not return a ref to the left-hand side. } } // ... void update(K, V, C, U)(ref V[K] aa, K key, scope C create, scope U update) if (is(typeof(create()) : V) && (is(typeof(update(aa[K.init])) : V) || is(typeof(update(aa[K.init])) == void))) { bool found; // if key is @safe-ly copyable, `update` may infer @safe static if (isSafeCopyable!K) { auto p = () @trusted { return cast(V*) _aaGetX(cast(AA*) , typeid(V[K]), V.sizeof, , found); } (); } else { auto p = cast(V*) _aaGetX(cast(AA*) , typeid(V[K]), V.sizeof, , found); } if (!found) { import core.internal.traits : hasElaborateMove; static if(hasElaborateMove!V) () @system { } (); (V value) @trusted { import core.lifetime : moveEmplace; moveEmplace(value, *p); } (create()); } else { static if (is(typeof(update(*p)) == void)) update(*p); else *p = update(*p); } } /// Forum thread: https://forum.dlang.org/post/cmvdguqsiqebppwdv...@forum.dlang.org --