Thread overview
[Issue 24453] [REG2.108] idup fails for inout(T)[] slices
Mar 26
kinke
Mar 26
kinke
Mar 26
Dlang Bot
Mar 27
Dlang Bot
Apr 01
Dlang Bot
March 26
https://issues.dlang.org/show_bug.cgi?id=24453

Steven Schveighoffer <schveiguy@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy@gmail.com

--- Comment #1 from Steven Schveighoffer <schveiguy@gmail.com> ---
druntime regression, though really we should just fix the `inout` restriction.

The `_d_newarrayUPureNothrow` is building an array of `inout(char)`, which is wrong at this point. It should always return mutable data, and then properly cast at the right place. Ideally, only one cast should ever be present.

The prior version of druntime avoids all the casts by just using `extern(C)` functions with `TypeInfo` and void arrays.

Change is here: https://github.com/dlang/dmd/pull/16097

--
March 26
https://issues.dlang.org/show_bug.cgi?id=24453

--- Comment #2 from kinke <kinke@gmx.net> ---
Thanks Steven for checking & linking.

> The `_d_newarrayUPureNothrow` is building an array of `inout(char)`, which is wrong at this point. It should always return mutable data, and then properly cast at the right place.

I think this used to be valid in general, but copy ctors made this all more complex - the element type might define a different copy ctor overload when constructing an immutable instance. In such a case of different copy ctor overloads, the template should probably fail to instantiate indeed; but obviously not for trivial types like char.

--
March 26
https://issues.dlang.org/show_bug.cgi?id=24453

--- Comment #3 from kinke <kinke@gmx.net> ---
Oh wait, `_d_newarrayUPureNothrow` is just allocating, not initializing. No problem with copy ctors then.

--
March 26
https://issues.dlang.org/show_bug.cgi?id=24453

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@kinke created dlang/dmd pull request #16337 "[stable] Fix Bugzilla Issue 24453 - idup fails for inout(T)[] slices" fixing this issue:

- Fix Bugzilla Issue 24453 - idup fails for inout(T)[] slices

https://github.com/dlang/dmd/pull/16337

--
March 27
https://issues.dlang.org/show_bug.cgi?id=24453

Dlang Bot <dlang-bot@dlang.rocks> changed:

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

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #16337 "[stable] Fix Bugzilla Issue 24453 - idup fails for inout(T)[] slices" was merged into stable:

- 2e8a37324c2586e0385c21d3874b99231329f3dc by Martin Kinkelin:
  Fix Bugzilla Issue 24453 - idup fails for inout(T)[] slices

https://github.com/dlang/dmd/pull/16337

--
April 01
https://issues.dlang.org/show_bug.cgi?id=24453

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #16355 "merge stable" was merged into master:

- 2c1deeced9df3cd8434d576e6e8733fc9d74f79f by Martin Kinkelin:
  Fix Bugzilla Issue 24453 - idup fails for inout(T)[] slices

https://github.com/dlang/dmd/pull/16355

--