Bug#642981: smaller example
Here is a short source triggering the bug.
# gcc-4.6 -c -O1 -gnatn pack.adb
package Pack is
type T is tagged null record;
type A is access T'Class;
type V (Discriminant : Boolean := True) is record
case Discriminant is
when False => I_Field : Integer;
when True => A_Field : A;
end case;
end record;
procedure Proc;
end Pack;
with Ada.Strings.Hash;
with Ada.Unchecked_Deallocation;
with Ada.Containers.Indefinite_Hashed_Maps;
package body Pack is
package Maps is new Ada.Containers.Indefinite_Hashed_Maps
(String, V, Ada.Strings.Hash, "=", "=");
M : Maps.Map;
procedure Free is new Ada.Unchecked_Deallocation (T'Class, A);
procedure Proc is
V_Variable : V := Maps.Element (Maps.First (M));
begin
Free (V_Variable.A_Field);
end Proc;
end Pack;
Reply to: