[Issue 22965] New: assocArray does not automatically select non-immutable types even if they're easily reachable.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 1 07:04:41 UTC 2022


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

          Issue ID: 22965
           Summary: assocArray does not automatically select non-immutable
                    types even if they're easily reachable.
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: default_357-line at yahoo.de

Consider the following code:

immutable int a;
auto b = [tuple(a, a)].assocArray;

assocArray should be able to see that while it gets an immutable int as value,
it can trivially convert that to int, which is allowed. Unfortunately, it
instead complains that "assocArray: value type must be mutable", forcing the
awkward `tuple!(int, int)(a, a)`.

--


More information about the Digitalmars-d-bugs mailing list