https://gcc.gnu.org/g:156c3e64ccc4f064b5eccabf0617246c37594aa2
commit r17-859-g156c3e64ccc4f064b5eccabf0617246c37594aa2 Author: Viljar Indus <[email protected]> Date: Wed Feb 18 11:29:23 2026 +0200 ada: Apply the check for all primitive equality operations gcc/ada/ChangeLog: * sem_ch6.adb (Check_For_Primitive_Subprogram): add the check for ghost equality functions for all branches handling primitive subprograms. Diff: --- gcc/ada/sem_ch6.adb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 73ad8cf8d54a..b0eeab5bdb6e 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -11920,6 +11920,14 @@ package body Sem_Ch6 is -- (SPARK RM 6.9(21)). Check_Ghost_Primitive (S, B_Typ); + + -- A user-defined primitive equality operation on a + -- non-ghost record type shall not be ghost, unless the + -- record type has only limited views. (SPARK RM 6.9(23)) + + if Chars (S) = Name_Op_Eq then + Check_Ghost_Equality_Op (S, B_Typ); + end if; end if; end if; @@ -11961,6 +11969,14 @@ package body Sem_Ch6 is -- (SPARK RM 6.9(21)). Check_Ghost_Primitive (S, B_Typ); + + -- A user-defined primitive equality operation on a + -- non-ghost record type shall not be ghost, unless the + -- record type has only limited views. (SPARK RM 6.9(23)) + + if Chars (S) = Name_Op_Eq then + Check_Ghost_Equality_Op (S, B_Typ); + end if; end if; Next_Formal (Formal);
