[Issue 17932] [scope] __traits(compiles, stmt) cannot test scope violations

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 11 23:53:29 UTC 2018


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

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Walter Bright <bugzilla at digitalmars.com> ---
Adding @safe to the lambda:

  void test() @safe
  {
    int var;
    scope int* p;
    static int* escape;
    static assert(!__traits(compiles, () @safe { escape = p; }));
  //    escape = p;
  }

and it compiles without error. The lambda does not inherit @safe from the
function. Perhaps it should, but that would be an enhancement request, and
would possibly break existing code. It should be the subject of a separate
issue.

--


More information about the Digitalmars-d-bugs mailing list