diff options
author | Steve Baird <baird@adacore.com> | 2019-12-13 09:04:48 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-12-13 09:04:48 +0000 |
commit | a85475beae62f908312ddb233d79cf1df60216e5 (patch) | |
tree | 4e32f241e2e242e0f673cccf4f255525337d4a32 | |
parent | 02458cc74236718edd74f3d4bd6cc259ebbba5ca (diff) | |
download | gcc-a85475beae62f908312ddb233d79cf1df60216e5.zip gcc-a85475beae62f908312ddb233d79cf1df60216e5.tar.gz gcc-a85475beae62f908312ddb233d79cf1df60216e5.tar.bz2 |
[Ada] Detect illegal implicit type conversions
2019-12-13 Steve Baird <baird@adacore.com>
gcc/ada/
* sem_res.adb (Resolve, Valid_Conversion): Add Base_Type call
when testing whether a type is a general access type.
From-SVN: r279357
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/sem_res.adb | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index dde5372..c920c2c 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-12-13 Steve Baird <baird@adacore.com> + + * sem_res.adb (Resolve, Valid_Conversion): Add Base_Type call + when testing whether a type is a general access type. + 2019-12-13 Javier Miranda <miranda@adacore.com> * exp_ch4.adb (Expand_N_Unchecked_Type_Conversion): Generate an diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 3568a89..54d4728 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -3256,7 +3256,7 @@ package body Sem_Res is -- convert implicitly are allowed in membership tests). if Ada_Version >= Ada_2012 - and then Ekind (Ctx_Type) = E_General_Access_Type + and then Ekind (Base_Type (Ctx_Type)) = E_General_Access_Type and then Ekind (Etype (N)) = E_Anonymous_Access_Type and then Nkind (Parent (N)) not in N_Membership_Test then @@ -13328,7 +13328,7 @@ package body Sem_Res is if Ada_Version >= Ada_2012 and then not Comes_From_Source (N) and then Is_Rewrite_Substitution (N) - and then Ekind (Target_Type) = E_General_Access_Type + and then Ekind (Base_Type (Target_Type)) = E_General_Access_Type and then Ekind (Opnd_Type) = E_Anonymous_Access_Type then if Is_Itype (Opnd_Type) then |