Bug 18606 – [REG2.072] "cannot append type const(T) to type T[]" in .dup

Status
NEW
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-03-13T15:56:49Z
Last change time
2024-12-13T18:57:51Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Vladimir Panteleev
See also
https://issues.dlang.org/show_bug.cgi?id=16607
Moved to GitHub: dmd#19409 →

Comments

Comment #0 by dlang-bugzilla — 2018-03-13T15:56:49Z
///////// test.d ///////// struct S { struct T { int foo; int[] bar; } struct M() { T[] arr; this(this) { arr = arr.dup; } } M!() m; } ////////////////////////// Introduced in https://github.com/dlang/dmd/pull/5500
Comment #1 by bugzilla — 2018-05-14T13:39:43Z
(In reply to Vladimir Panteleev from comment #0) > Introduced in https://github.com/dlang/dmd/pull/5500 This is why I don't like 700 line PRs spread across 18 files :-(
Comment #2 by dlang-bugzilla — 2018-05-14T19:39:02Z
The commits are big too, but if it helped, I can bisect it down to the commit.
Comment #3 by john.loughran.colvin — 2019-01-11T18:12:39Z
Related: struct S { string get(string key) { return key; } alias get this; } void main() { S[] a; auto b = a.dup; } /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(4473): Error: mutable method onlineapp.S.get is not callable using a const object /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(4473): Consider adding const or inout to onlineapp.S.get /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(4460): Error: template instance `object._dup!(const(S), S)` error instantiating /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(4424): instantiated from here: _trustedDup!(const(S), S) onlineapp.d(13): instantiated from here: dup!(S) and struct S { string get(string key) const { return key; } alias get this; } void main() { S[] a; auto b = a.dup; } /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(4473): Error: function onlineapp.S.get(string key) const is not callable using argument types () const /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(4473): missing argument for parameter #1: string key /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(4460): Error: template instance `object._dup!(const(S), S)` error instantiating /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(4424): instantiated from here: _trustedDup!(const(S), S) onlineapp.d(13): instantiated from here: dup!(S)
Comment #4 by robert.schadek — 2024-12-13T18:57:51Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19409 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB