summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch5.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/sem_ch5.adb')
-rw-r--r--gcc/ada/sem_ch5.adb24
1 files changed, 12 insertions, 12 deletions
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index 11439419a25..e5954a92110 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -579,21 +579,21 @@ package body Sem_Ch5 is
end if;
end if;
- -- Ada 2005 (AI-230 and AI-385): When the lhs type is an anonymous
- -- access type, apply an implicit conversion of the rhs to that type
- -- to force appropriate static and run-time accessibility checks.
- -- This applies as well to anonymous access-to-subprogram types that
- -- are component subtypes.
+ -- Ada 2005 (AI-385): When the lhs type is an anonymous access type,
+ -- apply an implicit conversion of the rhs to that type to force
+ -- appropriate static and run-time accessibility checks. This applies
+ -- as well to anonymous access-to-subprogram types that are component
+ -- subtypes or formal parameters.
if Ada_Version >= Ada_05
- and then
- Is_Access_Type (T1)
- and then
- (Is_Local_Anonymous_Access (T1)
- or else Can_Never_Be_Null (T1))
+ and then Is_Access_Type (T1)
then
- Rewrite (Rhs, Convert_To (T1, Relocate_Node (Rhs)));
- Analyze_And_Resolve (Rhs, T1);
+ if Is_Local_Anonymous_Access (T1)
+ or else Ekind (T2) = E_Anonymous_Access_Subprogram_Type
+ then
+ Rewrite (Rhs, Convert_To (T1, Relocate_Node (Rhs)));
+ Analyze_And_Resolve (Rhs, T1);
+ end if;
end if;
-- Ada 2005 (AI-231): Assignment to not null variable