[Issue 22572] Cannot define SumType over immutable struct with Nullable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 9 16:07:43 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=22572

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

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

--- Comment #3 from Dlang Bot <dlang-bot at dlang.rocks> ---
@pbackus created dlang/phobos pull request #8377 "Fix Issue 22572 - Cannot
define SumType over immutable struct with Nu…" fixing this issue:

- Fix Issue 22572 - Cannot define SumType over immutable struct with Nullable

  Previously, SumType incorrectly assumed that all members of an
  inout(SumType) must themselves be inout-qualified. However, this is not
  the case when one of those member types is declared as immutable, since
  the qualifier combination `immutable inout` collapses to just
  `immutable`.

  Attempting to copy an immutable member type as though it were inout
  caused matching to fail in SumType's copy constructor, due to the
  following (gagged) error:

    Error: `inout` on `return` means `inout` must be on a parameter as
    well for `pure nothrow @nogc @safe inout(Storage)(ref immutable(Value)
    value)`

https://github.com/dlang/phobos/pull/8377

--


More information about the Digitalmars-d-bugs mailing list