diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2023-07-11 16:37:23 +0200 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-07-28 09:28:14 +0200 |
commit | 8dcd763ac6203904339ccc87cfee28892dbb7231 (patch) | |
tree | dae1543c7072fba9cba714de34d7f116a1828b65 /gcc/ada/sem_res.adb | |
parent | 42fcc7503af42314369e84e9a2cecc04deef0aad (diff) | |
download | gcc-8dcd763ac6203904339ccc87cfee28892dbb7231.zip gcc-8dcd763ac6203904339ccc87cfee28892dbb7231.tar.gz gcc-8dcd763ac6203904339ccc87cfee28892dbb7231.tar.bz2 |
ada: Add guard for detection of class-wide precondition subprograms
When skipping check on subprograms built for class-wide preconditions
we must deal with the current scope not being a subprogram, e.g. it
could be a declare-block.
gcc/ada/
* sem_res.adb (Resolve_Actuals): Add guard for the call to
Class_Preconditions_Subprogram.
Diffstat (limited to 'gcc/ada/sem_res.adb')
-rw-r--r-- | gcc/ada/sem_res.adb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 2c8efec..d3a0192 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -5146,7 +5146,10 @@ package body Sem_Res is if Is_EVF_Expression (A) and then Extensions_Visible_Status (Nam) = Extensions_Visible_True - and then No (Class_Preconditions_Subprogram (Current_Scope)) + and then not + (Is_Subprogram (Current_Scope) + and then + Present (Class_Preconditions_Subprogram (Current_Scope))) then Error_Msg_N ("formal parameter cannot act as actual parameter when " |