+2019-12-12 Steve Baird <baird@adacore.com>
+
+ * sem_ch12.adb
+ (Instantiate_Type.Validate_Derived_Type_Instance): Implement the
+ legality check of AI12-0036
+
2019-12-12 Ed Schonberg <schonberg@adacore.com>
* sem_ch10.adb (Analyze_Subunit): Fix spurious visibility error
Abandon_Instantiation (Actual);
end if;
end if;
+
+ -- Don't check Ada_Version here (for now) because AI12-0036 is
+ -- a binding interpretation; this decision may be reversed if
+ -- the situation turns out to be similar to that of the preceding
+ -- Is_Limited_Type test (see preceding comment).
+
+ declare
+ Formal_Is_Private_Extension : constant Boolean :=
+ Nkind (Parent (A_Gen_T)) = N_Private_Extension_Declaration;
+
+ Actual_Is_Tagged : constant Boolean := Is_Tagged_Type (Act_T);
+ begin
+ if Actual_Is_Tagged /= Formal_Is_Private_Extension then
+ if In_Instance then
+ null;
+ else
+ if Actual_Is_Tagged then
+ Error_Msg_NE
+ ("actual for & cannot be a tagged type",
+ Actual, Gen_T);
+ else
+ Error_Msg_NE
+ ("actual for & must be a tagged type",
+ Actual, Gen_T);
+ end if;
+ Abandon_Instantiation (Actual);
+ end if;
+ end if;
+ end;
end Validate_Derived_Type_Instance;
----------------------------------------