From 6ab24ed7528b0375c49e4416f825a90bdca63454 Mon Sep 17 00:00:00 2001 From: Ed Schonberg Date: Mon, 12 Aug 2019 09:00:59 +0000 Subject: [Ada] Improper error message on equality op with different operand types 2019-08-12 Ed Schonberg gcc/ada/ * sem_ch6.adb (heck_Untagged_Equality): Verify that user-defined equality has the same profile as the predefined equality before applying legality rule in RM 4.5.2 (9.8). gcc/testsuite/ * gnat.dg/equal10.adb, gnat.dg/equal10.ads: New testcase. From-SVN: r274297 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/sem_ch6.adb | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'gcc/ada') diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 351cc49..3c22a90 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2019-08-12 Ed Schonberg + + * sem_ch6.adb (heck_Untagged_Equality): Verify that user-defined + equality has the same profile as the predefined equality before + applying legality rule in RM 4.5.2 (9.8). + 2019-08-12 Bob Duff * libgnat/a-except.ads: Update obsolete comment, still making diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 25ee705..3c026bf 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -8420,11 +8420,12 @@ package body Sem_Ch6 is begin -- This check applies only if we have a subprogram declaration with an - -- untagged record type. + -- untagged record type that is conformant to the predefined op. if Nkind (Decl) /= N_Subprogram_Declaration or else not Is_Record_Type (Typ) or else Is_Tagged_Type (Typ) + or else Etype (Next_Formal (First_Formal (Eq_Op))) /= Typ then return; end if; -- cgit v1.1