public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-2842] ada: Add guard for detection of class-wide precondition subprograms
@ 2023-07-28  7:30 Marc Poulhi?s
  0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2023-07-28  7:30 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:8dcd763ac6203904339ccc87cfee28892dbb7231

commit r14-2842-g8dcd763ac6203904339ccc87cfee28892dbb7231
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Tue Jul 11 16:37:23 2023 +0200

    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.

Diff:
---
 gcc/ada/sem_res.adb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 2c8efec524b..d3a0192fb09 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 "

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-28  7:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-28  7:30 [gcc r14-2842] ada: Add guard for detection of class-wide precondition subprograms Marc Poulhi?s

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).