[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2020-03-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 Walter Bright changed: What|Removed |Added Status|NEW |RESOLVED CC|

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2019-09-23 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 --- Comment #19 from Atila Neves --- I can't reproduce the issue anymore. It helps that I now understand DIP1000 a lot better than I did then. This seems to work fine: int* gInts; void main() @safe { scope s = MyStruct();

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2019-09-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 --- Comment #18 from Mike Franklin --- `scope ptr(this This)() { return ints; }` is ambiguous. Did you mean `scope int* ptr(this This)() { return ints; }` or `int* ptr(this This)() scope { return ints; }` The former is supposed to apply `scope` to

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2019-09-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 --- Comment #17 from Atila Neves --- After reading it again, I think the summary is (copied from earlier) this: Function template => inferred attributes => scope. But fine, this compiles and shouldn't: -- @safe: const(int)* gInts; void

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2019-09-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 --- Comment #16 from Mike Franklin --- This thread is hard to follow. What's the cut-and-paste test case that demonstrates the problem? --

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2018-08-23 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 --- Comment #15 from ag0aep6g --- (In reply to Atila Neves from comment #13) > > Apparently, DMD goes with infinite > > Only if it's a template this function. No. My statement was about the lifetime of `malloc(...)`, which is called in the

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2018-08-23 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 Mike Franklin changed: What|Removed |Added CC||slavo5...@yahoo.com --- Comment #14 from

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2018-08-23 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 --- Comment #13 from Atila Neves --- > Apparently, DMD goes with infinite Only if it's a template this function. As mentioned before, writing out the explicit instantitations for mutable, const and immutable doesn't compile. That's the bug. Hence

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2018-08-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 --- Comment #12 from ag0aep6g --- (In reply to Atila Neves from comment #11) > > You're still just copying an `int*` around, which isn't unsafe. > > Of course it is, that's basically the whole point of Rust and DIP1000. You're right. Of course DIP

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2018-08-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 --- Comment #11 from Atila Neves --- > @safe applies to functions/methods, not variables/fields. You can't forbid > @safe code from accessing a visible variable. Yes. But the code I presented is in one file for simplicity reasons. In real life

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2018-08-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 anonymous4 changed: What|Removed |Added Hardware|x86_64 |All OS|Linux

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2018-08-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 --- Comment #9 from ag0aep6g --- (In reply to Atila Neves from comment #8) > > @safe code can mess with it > > No it can't, that's the point of @safe. Mess with it how? @safe applies to functions/methods, not variables/fields. You can't forbid

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2018-08-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 --- Comment #8 from Atila Neves --- > @safe code can mess with it No it can't, that's the point of @safe. Mess with it how? > Why shouldn't this compile? There's no `scope` anywhere now (except maybe an > inferred one) Function template =>

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2018-08-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 --- Comment #7 from ag0aep6g --- (In reply to Atila Neves from comment #6) > What's @trusted is that I'm calling `free` on the same pointer I allocated > in the constructor, and the other thing needing checking is the postblit. If you want to keep

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2018-08-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 --- Comment #6 from Atila Neves --- I typed the code from memory and made a mistake. Yes, it's supposed to be `.ptr`. There's no way I can call core.stdc.stdlib.free without @trusted _somewhere_, since `free` isn't @safe - free(42) is obviously

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2018-08-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 --- Comment #5 from ag0aep6g --- (In reply to Atila Neves from comment #4) > I made a mistake when I posted the code. This compiles but shouldn't (the > only difference is removing `scope` from the destructor). [...] > @safe: > > const(int)*

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2018-08-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 --- Comment #4 from Atila Neves --- I made a mistake when I posted the code. This compiles but shouldn't (the only difference is removing `scope` from the destructor). I also surrounded the call to `free` with @trusted instead of the whole

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2018-08-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 ZombineDev changed: What|Removed |Added CC||petar.p.ki...@gmail.com --- Comment #3 from

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2018-08-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 --- Comment #2 from Atila Neves --- I used dmd 2.081.2. I just tried it again and it compiles. Just in case there's something wrong with the Arch Linux package, I used dmd.081.2 from install.sh. Same result. I also tried the 2.082.0 beta 1. Same

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2018-08-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 ag0aep6g changed: What|Removed |Added CC||ag0ae...@gmail.com --- Comment #1 from ag0aep6g

[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

2018-08-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19183 Atila Neves changed: What|Removed |Added Keywords||safe --