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
15731573and each value in turn.
15741574 */
15751575private T toImpl (T, S)(S value)
1576- if (isAssociativeArray! S &&
1576+ if (! isImplicitlyConvertible ! (S, T) && isAssociativeArray! S &&
15771577 isAssociativeArray! T && ! is (T == enum ))
15781578{
15791579 /* This code is potentially unsafe.
@@ -1619,6 +1619,16 @@ if (isAssociativeArray!S &&
16191619 auto d = to! (immutable (short [immutable wstring ])[immutable string [double []]])(c);
16201620}
16211621
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+
16221632private void testIntegralToFloating (Integral, Floating)()
16231633{
16241634 Integral a = 42 ;
You can’t perform that action at this time.
0 commit comments