[Issue 22215] New: [dip1000] scope analysis does not respect @system or @trusted

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 16 15:02:41 UTC 2021


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

          Issue ID: 22215
           Summary: [dip1000] scope analysis does not respect @system or
                    @trusted
           Product: D
           Version: D2
          Hardware: x86
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: Ajieskola at gmail.com

This does not compile with -dip1000:

```
int* f()
{ int x = 42;
  return &x;
}
```

There is a workaround that compiles:

```
int* f()
{ int x = 42;
  auto wannaBePointer = cast(size_t)&x;
  return cast(typeof(return)) wannaBePointer;
}
```

But according to the spec, only `@safe` code must analyzed with -dip1000 so
this workaround should not be required.

--


More information about the Digitalmars-d-bugs mailing list