aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2022-08-15 18:31:50 +0000
committerMarc Poulhiès <poulhies@adacore.com>2022-09-06 09:14:22 +0200
commit1c245f7273f170f3236f30562a72567be648c300 (patch)
treec0ff15d6470daf168664dfcd016581323d52e0cd /gcc
parentc889b2e8acc706b2c9fe6559c0094ce7785c3583 (diff)
downloadgcc-1c245f7273f170f3236f30562a72567be648c300.zip
gcc-1c245f7273f170f3236f30562a72567be648c300.tar.gz
gcc-1c245f7273f170f3236f30562a72567be648c300.tar.bz2
[Ada] Report error in non-legal class-wide conditions
gcc/ada/ * sem_prag.adb (Analyze_Pre_Post_Condition_In_Decl_Part): Improve check to report an error in non-legal class-wide conditions.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_prag.adb8
1 files changed, 3 insertions, 5 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index eaaf3d7..13cee59 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -26138,12 +26138,9 @@ package body Sem_Prag is
if Class_Present (N) then
-- Verify that a class-wide condition is legal, i.e. the operation is
- -- a primitive of a tagged type. Note that a generic subprogram is
- -- not a primitive operation.
+ -- a primitive of a tagged type.
- Disp_Typ := Find_Dispatching_Type (Spec_Id);
-
- if No (Disp_Typ) or else Is_Generic_Subprogram (Spec_Id) then
+ if not Is_Dispatching_Operation (Spec_Id) then
Error_Msg_Name_1 := Original_Aspect_Pragma_Name (N);
if From_Aspect_Specification (N) then
@@ -26162,6 +26159,7 @@ package body Sem_Prag is
-- Remaining semantic checks require a full tree traversal
else
+ Disp_Typ := Find_Dispatching_Type (Spec_Id);
Check_Class_Wide_Condition (Expr);
end if;