summaryrefslogtreecommitdiffstats
path: root/gcc/ada/a-cdlili.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/a-cdlili.adb')
-rw-r--r--gcc/ada/a-cdlili.adb16
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/ada/a-cdlili.adb b/gcc/ada/a-cdlili.adb
index 326c74b0785..8b513222ef8 100644
--- a/gcc/ada/a-cdlili.adb
+++ b/gcc/ada/a-cdlili.adb
@@ -515,10 +515,24 @@ package body Ada.Containers.Doubly_Linked_Lists is
LI, RI : Cursor;
begin
- if Target'Address = Source'Address then
+
+ -- The semantics of Merge changed slightly per AI05-0021. It was
+ -- originally the case that if Target and Source denoted the same
+ -- container object, then the GNAT implementation of Merge did
+ -- nothing. However, it was argued that RM05 did not precisely
+ -- specify the semantics for this corner case. The decision of the
+ -- ARG was that if Target and Source denote the same non-empty
+ -- container object, then Program_Error is raised.
+
+ if Source.Is_Empty then
return;
end if;
+ if Target'Address = Source'Address then
+ raise Program_Error with
+ "Target and Source denote same non-empty container";
+ end if;
+
if Target.Busy > 0 then
raise Program_Error with
"attempt to tamper with cursors of Target (list is busy)";
OpenPOWER on IntegriCloud