[Issue 14125] @trusted nested helper functions in std.file

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Feb 4 18:18:56 PST 2015


https://issues.dlang.org/show_bug.cgi?id=14125

--- Comment #38 from David Nadlinger <code at klickverbot.at> ---
(In reply to Walter Bright from comment #34)
> This also flunks that rule:
> 
>    @safe T* func(T* p) {
>        @trusted {
>           p += 5;
>        }
>        return p;
>    }

So does this:

---
@trusted void claimsToBeSafe(ref T* p) {
    p += 5;
}

@safe T* func(T* p) {
    claimsToBeSafe(p);
    return p;
}
---

And this:

---
@safe T* func(T* p) {
    @trusted void claimsToBeSafe(ref T* p) {
        p += 5;
    }
    claimsToBeSafe(p);
    return p;
}
---

What is your point?

@trusted can be used incorrectly. Nothing new and exciting so far.

--


More information about the Digitalmars-d-bugs mailing list