summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch3.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/sem_ch3.adb')
-rw-r--r--gcc/ada/sem_ch3.adb6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 555c361b1d3..d91f831ec33 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -3347,9 +3347,11 @@ package body Sem_Ch3 is
Obj_Id);
-- An object of a discriminated type cannot be effectively
- -- volatile (SPARK RM C.6(4)).
+ -- volatile except for protected objects (SPARK RM 7.1.3(5)).
- elsif Has_Discriminants (Obj_Typ) then
+ elsif Has_Discriminants (Obj_Typ)
+ and then not Is_Protected_Type (Obj_Typ)
+ then
Error_Msg_N
("discriminated object & cannot be volatile", Obj_Id);