The frontend silently skips propagating attributes Has_Predicates and
Predicate function to the internally built cloned subtype. This change
does not affect the functionality of the compiler; it leaves more clean
the decoration of internal entities.
Tested on x86_64-pc-linux-gnu, committed on trunk
2019-09-17 Javier Miranda <mira...@adacore.com>
gcc/ada/
* sem_ch3.adb (Complete_Private_Subtype): Propagate attributes
Has_Attributes and Predicate_Function to the cloned subtype.
--- gcc/ada/sem_ch3.adb
+++ gcc/ada/sem_ch3.adb
@@ -12509,6 +12509,18 @@ package body Sem_Ch3 is
-- Show Full is simply a renaming of Full_Base
Set_Cloned_Subtype (Full, Full_Base);
+
+ -- Propagate predicates
+
+ if Has_Predicates (Full_Base) then
+ Set_Has_Predicates (Full);
+
+ if Present (Predicate_Function (Full_Base))
+ and then No (Predicate_Function (Full))
+ then
+ Set_Predicate_Function (Full, Predicate_Function (Full_Base));
+ end if;
+ end if;
end if;
-- It is unsafe to share the bounds of a scalar type, because the Itype