Bug 17428 – [scope] class field assignment allows to escape scope parameters

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2017-05-24T21:39:42Z
Last change time
2017-08-16T13:24:13Z
Keywords
safe
Assigned to
No Owner
Creator
Martin Nowak

Comments

Comment #0 by code — 2017-05-24T21:39:42Z
cat > bug.d << CODE class Klazz { void set(scope int* p) @safe { _p = p; // should error, works for structs } int* _p; } Klazz test() @safe { int a; auto p = new Klazz(); p.set(&a); return p; } CODE dmd -c bug -dip1000
Comment #1 by code — 2017-05-24T21:41:20Z
Somewhat similar to issue 17370.
Comment #2 by bugzilla — 2017-07-26T00:34:09Z
Comment #3 by github-bugzilla — 2017-08-08T06:23:51Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/16a922f0864569b669b65448cf647de0c605e41d fix Issue 17428 - [scope] class field assignment allows to escape scope parameters https://github.com/dlang/dmd/commit/d61411be90d36439ab91418434f900cdf1bf5ade Merge pull request #7025 from WalterBright/fix17428 fix Issue 17428 - [scope] class field assignment allows to escape sco… merged-on-behalf-of: Rainer Schuetze <[email protected]>
Comment #4 by github-bugzilla — 2017-08-16T13:24:13Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/16a922f0864569b669b65448cf647de0c605e41d fix Issue 17428 - [scope] class field assignment allows to escape scope parameters https://github.com/dlang/dmd/commit/d61411be90d36439ab91418434f900cdf1bf5ade Merge pull request #7025 from WalterBright/fix17428