[Ada] Missing check on illegal equality operation in subprogram
authorEd Schonberg <schonberg@adacore.com>
Tue, 17 Jul 2018 08:09:14 +0000 (08:09 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Tue, 17 Jul 2018 08:09:14 +0000 (08:09 +0000)
commit2bbc7940969ba1840d103c3f0c6af2de2e67c514
tree672cf7cfb2bcd6fd572adb9d31a3a521416f8644
parent17d65c91925fd92a656eacc230c71d1def1eff42
[Ada] Missing check on illegal equality operation in subprogram

In Ada2012 it is illegal to declare an equality operation on an untagged
type when the operation is primitive and the type is already frozem (see
RM 4.5.2 (9.8)). previously the test to detect this illegality only examined
declarations within a package. This patch covers the case where type and
operation are both declared within a subprogram body.

2018-07-17  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_ch6.adb (Check_Untagged_Equality): Extend check to operations
declared in the same scope as the operand type, when that scope is a
procedure.

gcc/testsuite/

* gnat.dg/equal3.adb: New testcase.

From-SVN: r262788
gcc/ada/ChangeLog
gcc/ada/sem_ch6.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/equal3.adb [new file with mode: 0644]