[Issue 23124] [dip1000] scope inference leads to implementatio-defined semantics for @trusted and @system.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 17 14:20:51 UTC 2022


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

--- Comment #3 from Ate Eskola <Ajieskola at gmail.com> ---
Example in my last comment was wrong. Posting a corrected one:

----------------
struct MyType
{ private int* wontEverPointToLocal;
  int* mayPointToLocalIfScope;
  // Safe in the future compiler because
  // not callable with scope MyType.
  // Dangerous in DMD because it infers
  // scope for this reference.
  @trusted fun(bool cond){return cond? wontEverPointToLocal:
mayPointToLocalIfScope;}
}
----------------

--


More information about the Digitalmars-d-bugs mailing list