diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2021-09-10 22:27:20 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-10-05 08:20:02 +0000 |
commit | cc1fcd387984da9cde6d7314345d366789929d57 (patch) | |
tree | 944c6259453e536569cff8bd65c9621d28d78f42 /gcc/ada | |
parent | 04175813f920e8cb8ca146fb88a74edb33636b88 (diff) | |
download | gcc-cc1fcd387984da9cde6d7314345d366789929d57.zip gcc-cc1fcd387984da9cde6d7314345d366789929d57.tar.gz gcc-cc1fcd387984da9cde6d7314345d366789929d57.tar.bz2 |
[Ada] Propagate Ghost status from parent to derived subprograms
gcc/ada/
* sem_ch3.adb (Derive_Subprogram): Copy ghost status from parent
to derived subprogram.
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/sem_ch3.adb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index bf81f76..f1a56ad 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -16111,6 +16111,14 @@ package body Sem_Ch3 is Set_No_Return (New_Subp, No_Return (Parent_Subp)); + -- If the parent subprogram is marked as Ghost, then so is the derived + -- subprogram. The ghost policy for the derived subprogram is set from + -- the effective ghost policy at the point of derived type declaration. + + if Is_Ghost_Entity (Parent_Subp) then + Set_Is_Ghost_Entity (New_Subp); + end if; + -- A derived function with a controlling result is abstract. If the -- Derived_Type is a nonabstract formal generic derived type, then -- inherited operations are not abstract: the required check is done at |