[Issue 23667] [REG2.101] Incorrect escape deprecation on scope lazy pointer parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 3 12:18:47 UTC 2023


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

--- Comment #2 from RazvanN <razvan.nitu1305 at gmail.com> ---
Actually, it turns out you can escape i:

  struct S {
      this(ref int i) {
         DBG(&i);
      }
  }

  int* delegate() outer;

  void DBG(lazy scope int* args)
  {
      outer = &args;
  }

  void main()
  {
      int b;
      S s = S(b);

      import std.stdio;
      writeln(*outer());
  }

It seems that scope is not propagated on the extracted delegate.

--


More information about the Digitalmars-d-bugs mailing list