[Ada] Assign and Copy do not work for ordered and hashed maps

Arnaud Charlet charlet@adacore.com
Mon Jan 27 16:43:00 GMT 2014


Subprograms Assign and Copy in Containers.Ordered_Maps and
Containers.Hashed_Maps were not assigning or copying anything.
This patch fixes that. The test is to use these subprograms with a non
empty Source map and to check that the Target map is not empty.

Tested on x86_64-pc-linux-gnu, committed on trunk

2014-01-27  Vincent Celier  <celier@adacore.com>

	* a-coorma.adb, a-cohama.adb (Assign): Copy the Source to the Target,
	not the Target to itself.

-------------- next part --------------
Index: a-coorma.adb
===================================================================
--- a-coorma.adb	(revision 207120)
+++ a-coorma.adb	(working copy)
@@ -274,7 +274,7 @@
       end if;
 
       Target.Clear;
-      Insert_Items (Target.Tree);
+      Insert_Items (Source.Tree);
    end Assign;
 
    -------------
Index: a-cohama.adb
===================================================================
--- a-cohama.adb	(revision 207120)
+++ a-cohama.adb	(working copy)
@@ -167,7 +167,7 @@
          Target.Reserve_Capacity (Source.Length);
       end if;
 
-      Insert_Items (Target.HT);
+      Insert_Items (Source.HT);
    end Assign;
 
    --------------


More information about the Gcc-patches mailing list