← Back to index
|
Original Bugzilla link
Bug 16585 – dmd thinks function returns unique result despite mutable indirection in parameter
Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2016-10-03T22:07:37Z
Last change time
2024-12-13T18:50:22Z
Keywords
accepts-invalid
Assigned to
No Owner
Creator
ag0aep6g
Moved to GitHub: dmd#19198 →
Comments
Comment #0
by ag0aep6g — 2016-10-03T22:07:37Z
---- int[] fun(long[] arg) pure { return cast(int[]) arg; } void main() { long[] a = [1]; immutable i = fun(a); /* Should be rejected. Only ok when fun(a) is actually unique. */ immutable copy = i.dup; assert(copy == i); /* Passes. */ a[0] = 2; /* Affects the immutable i. */ assert(copy == i); /* Fails now. */ } ---- Possibly related to issue 15862.
Comment #1
by robert.schadek — 2024-12-13T18:50:22Z
THIS ISSUE HAS BEEN MOVED TO GITHUB
https://github.com/dlang/dmd/issues/19198
DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB