Skip to content

Commit

Permalink
Fix Indefinite_Holders "=" operator
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Jan 28, 2024
1 parent ecc3877 commit dff61d2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/aaa-containers-indefinite_holders.adb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@ with Ada.Unchecked_Deallocation;

package body AAA.Containers.Indefinite_Holders is

---------
-- "=" --
---------

overriding function "=" (L, R : Holder) return Boolean is
begin
if L.Is_Empty xor R.Is_Empty then
return False;
end if;

if L.Is_Empty and then R.Is_Empty then
return True;
end if;

return "=" (L.Item.all, R.Item.all);
end "=";

-----------
-- Clear --
-----------
Expand Down
6 changes: 5 additions & 1 deletion src/aaa-containers-indefinite_holders.ads
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ with Ada.Finalization;

generic
type Held (<>) is private;
with function "=" (L, R : Held) return Boolean is <>;
package AAA.Containers.Indefinite_Holders with Preelaborate is

-- Simple holder to work around GNAT holders bug
-- Simple holder to work around GNAT holders bug. Comparison uses the held
-- value.

type Holder is tagged private;

overriding function "=" (L, R : Holder) return Boolean;

Empty_Holder : constant Holder;

procedure Clear (This : in out Holder);
Expand Down

0 comments on commit dff61d2

Please sign in to comment.