Thread overview
[Issue 17370] [scope] Escaping scope pointers possible via struct GC allocation
May 24, 2017
Martin Nowak
Aug 22, 2017
ZombineDev
Aug 25, 2017
Walter Bright
Aug 25, 2017
Walter Bright
May 24, 2017
https://issues.dlang.org/show_bug.cgi?id=17370

Martin Nowak <code@dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code@dawg.eu
            Summary|[DIP1000] Escaping scope    |[scope] Escaping scope
                   |pointers possible via       |pointers possible via
                   |struct GC allocation        |struct GC allocation

--
August 22, 2017
https://issues.dlang.org/show_bug.cgi?id=17370

ZombineDev <petar.p.kirov@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |petar.p.kirov@gmail.com

--- Comment #1 from ZombineDev <petar.p.kirov@gmail.com> ---
The issue is with only with the auto generated constructor. If you write one yourself, you get:

void main () @safe
{
    int* ptr = fwd();
    assert(ptr !is null);
}

int* fwd () @safe
{
    int i;
    return new Struct(&i).oops;
}

struct Struct
{
    int* oops;
    this(int* p) @safe { oops = p; }
}

scope_bug17370.d(10): Error: reference to local variable i assigned to non-scope parameter p calling scope_bug17370.Struct.this

--
August 25, 2017
https://issues.dlang.org/show_bug.cgi?id=17370

Walter Bright <bugzilla@digitalmars.com> changed:

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

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
Note: compile with -dip1000 to repro the problem.

--
August 25, 2017
https://issues.dlang.org/show_bug.cgi?id=17370

--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> ---
https://github.com/dlang/dmd/pull/7101

--
September 01, 2017
https://issues.dlang.org/show_bug.cgi?id=17370

--- Comment #4 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/ae05c4c834ee9944f8fc0ed21a990335bcf36c81 fix Issue 17370 - [scope] Escaping scope pointers possible via struct GC allocation

https://github.com/dlang/dmd/commit/59e801d060ee13705cbf3bf73e1b4bc8a12aa60d Merge pull request #7101 from WalterBright/fix17370

fix Issue 17370 - [scope] Escaping scope pointers possible via struct… merged-on-behalf-of: Martin Nowak <code@dawg.eu>

--
September 01, 2017
https://issues.dlang.org/show_bug.cgi?id=17370

github-bugzilla@puremagic.com changed:

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

--
October 16, 2017
https://issues.dlang.org/show_bug.cgi?id=17370

--- Comment #5 from github-bugzilla@puremagic.com ---
Commits pushed to stable at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/ae05c4c834ee9944f8fc0ed21a990335bcf36c81 fix Issue 17370 - [scope] Escaping scope pointers possible via struct GC allocation

https://github.com/dlang/dmd/commit/59e801d060ee13705cbf3bf73e1b4bc8a12aa60d Merge pull request #7101 from WalterBright/fix17370

--