diff options
Diffstat (limited to 'gcc/ada/a-crbtgk.adb')
-rw-r--r-- | gcc/ada/a-crbtgk.adb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/ada/a-crbtgk.adb b/gcc/ada/a-crbtgk.adb index 6d748a30ec3..7fe8e3b5f67 100644 --- a/gcc/ada/a-crbtgk.adb +++ b/gcc/ada/a-crbtgk.adb @@ -254,13 +254,14 @@ package body Ada.Containers.Red_Black_Trees.Generic_Keys is Key : Key_Type; Z : out Node_Access) is - subtype Length_Subtype is Count_Type range 0 .. Count_Type'Last - 1; - - New_Length : constant Count_Type := Length_Subtype'(Tree.Length) + 1; - begin + if Tree.Length = Count_Type'Last then + raise Constraint_Error with "too many elements"; + end if; + if Tree.Busy > 0 then - raise Program_Error; + raise Program_Error with + "attempt to tamper with cursors (container is busy)"; end if; if Y = null @@ -316,7 +317,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Keys is Ops.Set_Parent (Z, Y); Ops.Rebalance_For_Insert (Tree, Z); - Tree.Length := New_Length; + Tree.Length := Tree.Length + 1; end Generic_Insert_Post; ----------------------- |