File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -1573,7 +1573,7 @@ Associative array to associative array conversion converts each key
1573
1573
and each value in turn.
1574
1574
*/
1575
1575
private T toImpl (T, S)(S value)
1576
- if (isAssociativeArray! S &&
1576
+ if (! isImplicitlyConvertible ! (S, T) && isAssociativeArray! S &&
1577
1577
isAssociativeArray! T && ! is (T == enum ))
1578
1578
{
1579
1579
/* This code is potentially unsafe.
@@ -1619,6 +1619,16 @@ if (isAssociativeArray!S &&
1619
1619
auto d = to! (immutable (short [immutable wstring ])[immutable string [double []]])(c);
1620
1620
}
1621
1621
1622
+ @safe unittest
1623
+ {
1624
+ import std.algorithm.comparison : equal;
1625
+ import std.array : byPair;
1626
+
1627
+ int [int ] a;
1628
+ assert (a.to! (int [int ]) == a);
1629
+ assert (a.to! (const (int )[int ]).byPair.equal(a.byPair));
1630
+ }
1631
+
1622
1632
private void testIntegralToFloating (Integral, Floating)()
1623
1633
{
1624
1634
Integral a = 42 ;
You can’t perform that action at this time.
0 commit comments