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

--- Comment #4 from Walter Bright <[email protected]> ---
A better test case, with and without the error message:

  @safe void check2() {
    int random;

    S create1() { return S(); }

    scope S gen1 = create1;  // no error

    S create2() { return S(&random); }

    // address of struct temporary returned by `create()` assigned to longer
lived variable `gen`
    scope S gen2 = create2;
  }

  struct S { int* r; }

--

Reply via email to