This patch fixes an issue whereby the compiler failed to issue an error
on the use of the attribute Result when the prefix is a non-subprogram.

Tested on x86_64-pc-linux-gnu, committed on trunk

2019-12-12  Justin Squirek  <[email protected]>

gcc/ada/

        * sem_attr.adb (Analyze_Attribute): Add error message for
        invalid usage of Attribute_Result.
--- gcc/ada/sem_attr.adb
+++ gcc/ada/sem_attr.adb
@@ -5414,6 +5414,7 @@ package body Sem_Attr is
             Spec_Id := Entity (P);
 
          elsif not Legal then
+            Error_Attr ("prefix of % attribute must be a function", P);
             return;
          end if;
 

Reply via email to