https://issues.dlang.org/show_bug.cgi?id=19183
Walter Bright changed:
What|Removed |Added
Status|NEW |RESOLVED
CC|
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();
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
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
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?
--
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
https://issues.dlang.org/show_bug.cgi?id=19183
Mike Franklin changed:
What|Removed |Added
CC||slavo5...@yahoo.com
--- Comment #14 from
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
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
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
https://issues.dlang.org/show_bug.cgi?id=19183
anonymous4 changed:
What|Removed |Added
Hardware|x86_64 |All
OS|Linux
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
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 =>
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
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
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)*
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
https://issues.dlang.org/show_bug.cgi?id=19183
ZombineDev changed:
What|Removed |Added
CC||petar.p.ki...@gmail.com
--- Comment #3 from
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
https://issues.dlang.org/show_bug.cgi?id=19183
ag0aep6g changed:
What|Removed |Added
CC||ag0ae...@gmail.com
--- Comment #1 from ag0aep6g
https://issues.dlang.org/show_bug.cgi?id=19183
Atila Neves changed:
What|Removed |Added
Keywords||safe
--
21 matches
Mail list logo