[Ada] Spurious warning when using 'Type_Key on generic formal
Commit Message
This patch corrects an issue in the compiler whereby spurious
compile-time warnings get raised when the attribute 'Type_Key is applied
to a generic formal type.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* sem_attr.adb (Type_Key): Avoid premature use warnings when the
prefix is a generic actual.
@@ -6664,6 +6664,7 @@ package body Sem_Attr is
if not Is_Frozen (Entity (P))
and then not Is_Generic_Type (Entity (P))
+ and then not Is_Generic_Actual_Type (Entity (P))
then
Error_Msg_N ("premature usage of Type_Key?", N);
end if;