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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 9 22:50:16 UTC 2022


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

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

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

--- Comment #4 from Dlang Bot <dlang-bot at dlang.rocks> ---
dlang/phobos pull request #8377 "Fix Issue 22572 - Cannot define SumType over
immutable struct with Nu…" was merged into master:

- 32924e3fc34676bb4e89efcbcbd202e6e9af911f by Paul Backus:
  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