[Issue 20868] New: DIP1000: scope delegate is implicitly convertible to non-scope delegate
https://issues.dlang.org/show_bug.cgi?id=20868 Issue ID: 20868 Summary: DIP1000: scope delegate is implicitly convertible to non-scope delegate Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: critical Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: andrej.mitrov...@gmail.com - void scoped (scope void delegate() dg) { static void delegate()[] dgs; // dgs ~= dg; // error nonScoped(dg); // not an error??? } void nonScoped (void delegate() dg) { static void delegate()[] dgs; dgs ~= dg; } void main () { int x; scoped({x = 100;}); } - $ dmd -dip1000 test.d > This should be a compile-time error. --
[Issue 20861] Interface implementations are not checked when code gen is skipped
https://issues.dlang.org/show_bug.cgi?id=20861 Dlang Bot changed: What|Removed |Added Keywords||pull --- Comment #1 from Dlang Bot --- @jacob-carlborg created dlang/dmd pull request #11191 "Fix issue 20861: Interface implementations are not checked when code gen is skipped" fixing this issue: - Fix issue 20861: Interface implementations are not checked when code gen is skipped The problem being that check was performed when the vtable was generated, during code generation. If the compiler was invoked with `-o-`, which skips code generation, the check was not performed. The fix is to move the check to the semantic phase of the compilation. This is also required for Objective-C classes, which don't have a vtable at all, even during code generation. https://github.com/dlang/dmd/pull/11191 --
[Issue 20867] class subtyping doen't work in separate files
https://issues.dlang.org/show_bug.cgi?id=20867 --- Comment #1 from mw --- Created attachment 1792 --> https://issues.dlang.org/attachment.cgi?id=1792=edit class subtyping doen't work in separate files Two files: queue.d t.d --
[Issue 20867] New: class subtyping doen't work in separate files
https://issues.dlang.org/show_bug.cgi?id=20867 Issue ID: 20867 Summary: class subtyping doen't work in separate files Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: min...@gmail.com Created attachment 1791 --> https://issues.dlang.org/attachment.cgi?id=1791=edit class subtyping doen't work in separate files Put the code on page: https://tour.dlang.org/tour/en/multithreading/synchronization-sharing in to queue.d, then add subtyping and a test func f(): ... private T[] elements; public: alias elements this; // add this line ... // test f() class T{} void f() { auto q = new shared(SafeQueue!(shared T)); writeln(q.length); } If f() is in the same file queue.d, the code can compile; if it's in a separate file, compile will fail. $ cat queue.d import std.stdio; import std.concurrency : receiveOnly, send, spawn, Tid, thisTid; import core.atomic : atomicOp, atomicLoad; /* Queue that can be used safely among different threads. All access to an instance is automatically locked thanks to synchronized keyword. */ synchronized class SafeQueue(T) { // Note: must be private in synchronized // classes otherwise D complains. private T[] elements; public: alias elements this; void push(T value) { elements ~= value; } /// Return T.init if queue empty T pop() { import std.array : empty; T value; if (elements.empty) return value; value = elements[0]; elements = elements[1 .. $]; return value; } } /* Safely print messages independent of number of concurrent threads. Note that variadic parameters are used for args! That is args might be 0 .. N parameters. */ void safePrint(T...)(T args) { // Just executed by one concurrently synchronized { import std.stdio : writeln; writeln(args); } } void threadProducer(shared(SafeQueue!int) queue, shared(int)* queueCounter) { import std.range : iota; // Push values 1 to 10 foreach (i; 1..11) { queue.push(i); safePrint("Pushed ", i); atomicOp!"+="(*queueCounter, 1); } } void threadConsumer(Tid owner, shared(SafeQueue!int) queue, shared(int)* queueCounter) { int popped = 0; while (popped != 10) { auto i = queue.pop(); if (i == int.init) continue; ++popped; // safely fetch current value of // queueCounter using atomicLoad safePrint("Popped ", i, " (Consumer pushed ", atomicLoad(*queueCounter), ")"); } // I'm done! owner.send(true); } void main() { auto queue = new shared(SafeQueue!int); shared int counter = 0; spawn(, queue, ); auto consumer = spawn(, thisTid, queue, ); auto stopped = receiveOnly!bool; assert(stopped); } class T{} void f() { auto q = new shared(SafeQueue!(shared T)); writeln(q.length); } $ dmd queue.d # succeed. $ cat t.d # put T and f() in separate file t.d: import std.stdio; import queue; class T{} void f() { auto q = new shared(SafeQueue!(shared T)); writeln(q.length); } $ dmd t.d t.d(9): Error: no property length for type shared(queue.SafeQueue!(shared(T))) --
[Issue 11292] Cannot re-initialize a const field in postblit
https://issues.dlang.org/show_bug.cgi?id=11292 Dlang Bot changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #4 from Dlang Bot --- dlang/dmd pull request #11190 "Fix Issue 11292 - Cannot re-initialize a const field in postblit" was merged into master: - 68275da1a9785ad0bf15782da6502948171271bd by Martin Kinkelin: Fix Issue 11292 - Cannot re-initialize a const field in postblit https://github.com/dlang/dmd/pull/11190 --
[Issue 20787] Add module core.sys.darwin.sys.attr with getattrlist, setattrlist, searchfs, and related definitions
https://issues.dlang.org/show_bug.cgi?id=20787 --- Comment #3 from Dlang Bot --- dlang/druntime pull request #3116 "Followup to #3076: make core.sys.darwin.sys.attr.attrlist usable in betterC" was merged into master: - 49b70549c319c9615f06f5453ffd9d0225283da6 by Nathan Sashihara: Issue 20787 - Followup: remove field initializers from core.sys.darwin.sys.attr.attrlist so it can be used in betterC https://github.com/dlang/druntime/pull/3116 --