From: Viljar Indus <[email protected]>
gcc/ada/ChangeLog:
* sem_ch6.adb (Check_For_Primitive_Subprogram): add the
check for ghost equality functions for all branches handling
primitive subprograms.
Tested on x86_64-pc-linux-gnu, committed on master.
---
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 73ad8cf8d54..b0eeab5bdb6 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);
--
2.53.0