[Issue 22563] Nested structs, if not escaping, shouldn't allocate context (just like delegates)

2021-12-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22563 kinke changed: What|Removed |Added CC||ki...@gmx.net --- Comment #1 from kinke --- `scope

[Issue 22563] Nested structs, if not escaping, shouldn't allocate context (just like delegates)

2021-12-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22563 --- Comment #2 from Stanislav Blinov --- It should in @safe code, which is where `scope` matters. The only way to escape it should be to break @safe. Isn't that the whole point?.. void* global; struct Escapist(T) { T value; } @safe void consum

[Issue 22563] Nested structs, if not escaping, shouldn't allocate context (just like delegates)

2021-12-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22563 --- Comment #3 from Stanislav Blinov --- IOW, if there is a way to escape it, there's a bug. --

[Issue 22563] Nested structs, if not escaping, shouldn't allocate context (just like delegates)

2021-12-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22563 --- Comment #4 from kinke --- This currently compiles even with -dip1000: ``` void consumeThingWithContext(S)(scope S s) if (is(S == struct) && __traits(isNested, S)) { static S global; global = s; } //@safe //@nogc void main() { int a;

[Issue 22563] Nested structs, if not escaping, shouldn't allocate context (just like delegates)

2021-12-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22563 --- Comment #5 from Stanislav Blinov --- Well... the `static S s;` simply shouldn't compile at all for exactly that reason, so that's one extra bug: struct WTF(T) { static T x; void foo() { x.foo(); } } @safe void main() { int a; st

[Issue 22563] Nested structs, if not escaping, shouldn't allocate context (just like delegates)

2021-12-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22563 --- Comment #6 from Stanislav Blinov --- Forgot to add the boom to main: WTF!Nested.foo; --

[Issue 22563] Nested structs, if not escaping, shouldn't allocate context (just like delegates)

2021-12-08 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22563 Stanislav Blinov changed: What|Removed |Added See Also||https://issues.dlang.org/sh

[Issue 22563] Nested structs, if not escaping, shouldn't allocate context (just like delegates)

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22563 Iain Buclaw changed: What|Removed |Added Priority|P1 |P4 --