diff options
author | Ed Schonberg <schonberg@adacore.com> | 2019-07-10 08:59:55 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-07-10 08:59:55 +0000 |
commit | ff3ee5e5ef8c91d94a0ff6236a46dc46a670f1c3 (patch) | |
tree | 54e1002b0622f74c880643bbeb9cd87b78864ade /gcc/ada | |
parent | 19448640ac04e980ef665ae72bc3f106b4e5b6e0 (diff) | |
download | gcc-ff3ee5e5ef8c91d94a0ff6236a46dc46a670f1c3.zip gcc-ff3ee5e5ef8c91d94a0ff6236a46dc46a670f1c3.tar.gz gcc-ff3ee5e5ef8c91d94a0ff6236a46dc46a670f1c3.tar.bz2 |
[Ada] Spurious error on overloaded equality in postcondition
This patch fixes a spurious error in a postcondition in a nested
instantiation when the expression includes an inherited equality and
checks are enabled.
2019-07-10 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_res.adb (Resolve_Equality_Op): Do not replace the resolved
operator by its alias if expander is not active, because the
operand type may not be frozen yet and its inherited operations
have not yet been created.
gcc/testsuite/
* gnat.dg/equal8.adb, gnat.dg/equal8.ads,
gnat.dg/equal8_pkg.ads: New testcase.
From-SVN: r273327
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ada/sem_res.adb | 9 |
2 files changed, 15 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 0973593..762db94 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2019-07-10 Ed Schonberg <schonberg@adacore.com> + + * sem_res.adb (Resolve_Equality_Op): Do not replace the resolved + operator by its alias if expander is not active, because the + operand type may not be frozen yet and its inherited operations + have not yet been created. + 2019-07-10 Hristian Kirtchev <kirtchev@adacore.com> * bindo-elaborators.adb (Elaborate_Units): Set attribute diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index d505bc5..4f56c53 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -8471,7 +8471,14 @@ package body Sem_Res is Get_Next_Interp (I, It); end loop; - if Present (Alias (Entity (N))) then + -- If expansion is active and this is wn inherited operation, + -- replace it with its ancestor. This must not be done during + -- preanalysis because the type nay not be frozen yet, as when + -- the context is a pre/post condition. + + if Present (Alias (Entity (N))) + and then Expander_Active + then Set_Entity (N, Alias (Entity (N))); end if; end; |