diff options
author | Justin Squirek <squirek@adacore.com> | 2021-06-22 17:31:55 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-09-20 12:31:29 +0000 |
commit | 518cededb0ca426ef6fd04bb9e4db2082da671e2 (patch) | |
tree | b1eda946fccf5803aa78ef83ca2850d7dafffb87 | |
parent | 66fa923768870fbd943ad986d0f501cef21bd958 (diff) | |
download | gcc-518cededb0ca426ef6fd04bb9e4db2082da671e2.zip gcc-518cededb0ca426ef6fd04bb9e4db2082da671e2.tar.gz gcc-518cededb0ca426ef6fd04bb9e4db2082da671e2.tar.bz2 |
[Ada] Spurious accessibility error on allocator in generic instance
gcc/ada/
* exp_ch4.adb (Expand_N_Type_Conversion): Add guard to protect
against calculating accessibility levels against internal
compiler-generated types.
-rw-r--r-- | gcc/ada/exp_ch4.adb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 16f513e..45b9c76 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -12361,10 +12361,16 @@ package body Exp_Ch4 is -- an instantiation, otherwise the conversion will already have been -- rejected as illegal. - -- Note: warnings are issued by the analyzer for the instance cases + -- Note: warnings are issued by the analyzer for the instance cases, + -- and, since we are late in expansion, a check is performed to + -- verify that neither the target type nor the operand type are + -- internally generated - as this can lead to spurious errors when, + -- for example, the operand type is a result of BIP expansion. elsif In_Instance_Body and then Statically_Deeper_Relation_Applies (Target_Type) + and then not Is_Internal (Target_Type) + and then not Is_Internal (Operand_Type) and then Type_Access_Level (Operand_Type) > Type_Access_Level (Target_Type) then |