Index: tests/natools-reference_tests.adb ================================================================== --- tests/natools-reference_tests.adb +++ tests/natools-reference_tests.adb @@ -55,10 +55,17 @@ Instance_Count := Instance_Count + 1; return Counter'(Ada.Finalization.Limited_Controlled with Instance_Number => Instance_Count); end Factory; + + overriding procedure Initialize (Object : in out Counter) is + begin + Instance_Count := Instance_Count + 1; + Object.Instance_Number := Instance_Count; + end Initialize; + overriding procedure Finalize (Object : in out Counter) is pragma Unreferenced (Object); begin Instance_Count := Instance_Count - 1; @@ -230,11 +237,12 @@ begin declare procedure Check (Count_0, Count_1, Count_2, Delta_I : in Integer); Ref_0 : Refs.Reference := Refs.Create (Factory'Access); - Ref_1, Ref_2 : Refs.Reference; + Ref_1 : Refs.Reference := Refs.Create (Refs.Data_Access'(null)); + Ref_2 : Refs.Reference; procedure Check (Count_0, Count_1, Count_2, Delta_I : in Integer) is begin Check_Ref (Report, Name, Ref_0, Count_0, Continue); Check_Ref (Report, Name, Ref_1, Count_1, Continue); @@ -246,11 +254,11 @@ end Check; begin Check (1, 0, 0, 1); if Continue then - Ref_1 := Refs.Create (Factory'Access); + Ref_1 := Refs.Create (new Counter); end if; Check (1, 1, 0, 2); if Continue then @@ -264,11 +272,11 @@ end if; Check (3, 3, 3, 1); if Continue then - Ref_2.Replace (Factory'Access); + Ref_2.Replace (new Counter); end if; Check (2, 2, 1, 2); if Continue then Index: tests/natools-reference_tests.ads ================================================================== --- tests/natools-reference_tests.ads +++ tests/natools-reference_tests.ads @@ -45,10 +45,11 @@ type Counter is new Ada.Finalization.Limited_Controlled with record Instance_Number : Natural := 0; end record; function Factory return Counter; + overriding procedure Initialize (Object : in out Counter); overriding procedure Finalize (Object : in out Counter); Pool : GNAT.Debug_Pools.Debug_Pool; package Refs is new Natools.References