[Issue 19175] @safe code can escape local array references

2019-08-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19175

--- Comment #9 from ag0aep6g  ---
(In reply to Mike Franklin from comment #8)
> Works for me as in v2.087.1

Most of the test cases are correctly rejected now with -dip1000. But the one
from comment #7 is still accepted. Moved to issue 20150.

--


[Issue 19175] @safe code can escape local array references

2019-08-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19175

Mike Franklin  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WORKSFORME

--- Comment #8 from Mike Franklin  ---
Works for me as in v2.087.1

--


[Issue 19175] @safe code can escape local array references

2018-08-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19175

--- Comment #6 from anonymous4  ---
Same for pointers:

@safe:

struct A(T)
{
int* r;
this(int* q){r=q;}
}

int* escape(T)(int* r)
{
return A!int(r).r;
}

int* f()
{
int x;
return escape!int();
}

--


[Issue 19175] @safe code can escape local array references

2018-08-26 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19175

Radu Racariu  changed:

   What|Removed |Added

 CC||radu.raca...@gmail.com

--- Comment #5 from Radu Racariu  ---
Under dip1000, what I think is that slicing a static array should always be
considered scope.

Also, calling a functions with a scope slice with the parameter for the slice
not annotated as scope should result in an error if the compiler can't prove
that the parameter can't escape.

--


[Issue 19175] @safe code can escape local array references

2018-08-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19175

--- Comment #4 from anonymous4  ---
@safe:

struct A(T)
{
int[] r;
this(int[] q){r=q;}
}

int[] escape(T)(int[] r)
{
return A!int(r).r;
}

int[] f()
{
int[6] xs = [0, 1, 2, 3, 4, 5];
return xs.escape!int;
}

--


[Issue 19175] @safe code can escape local array references

2018-08-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19175

--- Comment #3 from anonymous4  ---
Reduced:

@safe:

struct A(alias fun)
{
int[] r;
this(int[] q){r=q;}
}

template m(alias fun)
{
auto m(int[] r)
{
return A!fun(r);
}
}

auto foo() {
  int[6] xs = [0, 1, 2, 3, 4, 5];
  return xs[].m!(x => x);
}

void main() {
  auto a=foo();
}

--


[Issue 19175] @safe code can escape local array references

2018-08-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19175

Seb  changed:

   What|Removed |Added

 CC||greensunn...@gmail.com

--


[Issue 19175] @safe code can escape local array references

2018-08-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19175

--- Comment #2 from Peter Alexander  ---
It is still broken with -dip1000

https://run.dlang.io/is/gJi2Fa

--


[Issue 19175] @safe code can escape local array references

2018-08-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19175

Mike Franklin  changed:

   What|Removed |Added

   Keywords||safe
 CC||slavo5...@yahoo.com

--


[Issue 19175] @safe code can escape local array references

2018-08-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19175

Jonathan M Davis  changed:

   What|Removed |Added

 CC||issues.dl...@jmdavisprog.co
   ||m

--- Comment #1 from Jonathan M Davis  ---
This is a duplicate of https://issues.dlang.org/show_bug.cgi?id=8838, which was
closed as fixed based on the fact that -dip1000 fixes the problem. It's still
quite broken without -dip1000 though.

--


[Issue 19175] @safe code can escape local array references

2018-08-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19175

Peter Alexander  changed:

   What|Removed |Added

   Keywords||accepts-invalid

--