===================================================================
@@ -4583,7 +4583,9 @@
-- Used_As_Generic_Actual (Flag222)
-- Defined in all entities, set if the entity is used as an argument to
+-- a generic instantiation. Used to tune certain warning messages, and
+-- in checking type conformance within an instantiation that involves
+-- incomplete formal and actual types.
-- Uses_Lock_Free (Flag188)
-- Defined in protected type entities. Set to True when the Lock Free
===================================================================
@@ -7666,10 +7666,12 @@
return True;
-- In Ada 2012, incomplete types (including limited views) can appear
- -- as actuals in instantiations.
+ -- as actuals in instantiations, where they are conformant to the
+ -- corresponding incomplete formal.
elsif Is_Incomplete_Type (Type_1)
and then Is_Incomplete_Type (Type_2)
+ and then In_Instance
and then (Used_As_Generic_Actual (Type_1)
or else Used_As_Generic_Actual (Type_2))
then
===================================================================
@@ -0,0 +1,15 @@
+-- { dg-do compile }
+
+package body Incomplete6 is
+
+ function "=" (Left, Right : Vint) return Boolean is
+ begin
+ return Left.Value = Right.Value;
+ end;
+
+ function "=" (Left, Right : Vfloat) return Boolean is
+ begin
+ return Left.Value = Right.Value;
+ end;
+
+end;
===================================================================
@@ -0,0 +1,22 @@
+with Ada.Unchecked_Conversion;
+
+package Incomplete6 is
+
+ type Vint;
+ function "=" (Left, Right : Vint) return Boolean;
+
+ type Vint is record
+ Value : Integer;
+ end record;
+
+ function To_Integer is new
+ Ada.Unchecked_Conversion(Source => Vint, Target => Integer);
+
+ type Vfloat;
+ function "=" (Left, Right : in Vfloat) return Boolean;
+
+ type Vfloat is record
+ Value : Float;
+ end record;
+
+end;