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

Walter Bright <bugzi...@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzi...@digitalmars.com

--- Comment #2 from Walter Bright <bugzi...@digitalmars.com> ---
(In reply to ZombineDev from comment #1)
> While previous case was rejects-valid, here's a similar one where the
> compile accepts invalid code:

Reducing the case to:

  struct Context { char[] str; }

  void main() {
    Context[1] c;
    use(c);
  }

  Context[] global;

  void use(scope ref Context[1] c) @safe {
    global = c[];
    global = c;
  }

and compiling with no flags:

  test1.d(13): Error: address of variable c assigned to global with longer
lifetime
  test1.d(14): Error: address of variable c assigned to global with longer
lifetime

compiling with -dip1000:

  test1.d(13): Error: cannot take address of scope parameter c in @safe
function use
  test1.d(14): Error: address of variable c assigned to global with longer
lifetime

The different messages are because of the different order things happen due to
the rewriting. But the error messages are still there and are correct.

Perhaps you're testing with an older compiler?

--

Reply via email to