From d449ed7517e34dc3b24c60f2d374a94f46b220d5 Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Mon, 25 Sep 2017 09:34:10 +0000 Subject: [multiple changes] 2017-09-25 Piotr Trojanek * adabkend.adb (Call_Back_End): Fix wording of "front-end" and "back-end" in comments. 2017-09-25 Ed Schonberg * exp_ch6.adb (Expand_Call_Helper): The extra accessibility check in a call that appears in a classwide precondition and that mentions an access formal of the subprogram, must use the accessibility level of the actual in the call. This is one case in which a reference to a formal parameter appears outside of the body of the subprogram. From-SVN: r253141 --- gcc/ada/exp_ch6.adb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'gcc/ada/exp_ch6.adb') diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index c2edde6..2ee1c78 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -3004,6 +3004,20 @@ package body Exp_Ch6 is then Prev_Orig := Prev; + -- A class-wide precondition generates a test in which formals of + -- the subprogram are replaced by actuals that came from source. + -- In that case as well, the accessiblity comes from the actual. + -- This is the one case in which there are references to formals + -- outside of their subprogram. + + elsif Prev_Orig /= Prev + and then Is_Entity_Name (Prev_Orig) + and then Present (Entity (Prev_Orig)) + and then Is_Formal (Entity (Prev_Orig)) + and then not In_Open_Scopes (Scope (Entity (Prev_Orig))) + then + Prev_Orig := Prev; + -- If the actual is a formal of an enclosing subprogram it is -- the right entity, even if it is a rewriting. This happens -- when the call is within an inherited condition or predicate. -- cgit v1.1