diff options
author | Bob Duff <duff@adacore.com> | 2019-12-18 07:14:13 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-12-18 07:14:13 +0000 |
commit | af552cd02f23d3aa90268f0d91008545d4d8ddd2 (patch) | |
tree | 21af08933d26849e58cf76660f3eb811226e3295 /gcc | |
parent | 4f691cb20d7a83dc332ae538f23fcae14a07522d (diff) | |
download | gcc-af552cd02f23d3aa90268f0d91008545d4d8ddd2.zip gcc-af552cd02f23d3aa90268f0d91008545d4d8ddd2.tar.gz gcc-af552cd02f23d3aa90268f0d91008545d4d8ddd2.tar.bz2 |
[Ada] Wrong error on hidden must-override primitive
2019-12-18 Bob Duff <duff@adacore.com>
gcc/ada/
* sem_ch3.adb (Derive_Subprogram): Do not set the
Requires_Overriding flag in the above-mentioned case.
From-SVN: r279505
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/sem_ch3.adb | 13 |
2 files changed, 16 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 36e5d00..6f6caf4 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,10 @@ 2019-12-18 Bob Duff <duff@adacore.com> + * sem_ch3.adb (Derive_Subprogram): Do not set the + Requires_Overriding flag in the above-mentioned case. + +2019-12-18 Bob Duff <duff@adacore.com> + * sem_ch8.adb (Note_Redundant_Use): It was already checking for a use clause in the visible part of the child. Add an additional check for a use clause in the context clause of the child. diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index ca22476..956c92d 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -15606,7 +15606,8 @@ package body Sem_Ch3 is Set_Derived_Name; -- Otherwise, the type is inheriting a private operation, so enter it - -- with a special name so it can't be overridden. + -- with a special name so it can't be overridden. See also below, where + -- we check for this case, and if so avoid setting Requires_Overriding. else Set_Chars (New_Subp, New_External_Name (Chars (Parent_Subp), 'P')); @@ -15786,7 +15787,15 @@ package body Sem_Ch3 is or else Is_Abstract_Subprogram (Alias (New_Subp)) then Set_Is_Abstract_Subprogram (New_Subp); - else + + -- If the Chars of the new subprogram is different from that of the + -- parent's one, it means that we entered it with a special name so + -- it can't be overridden (see above). In that case we had better not + -- *require* it to be overridden. This is the case where the parent + -- type inherited the operation privately, so there's no danger of + -- dangling dispatching. + + elsif Chars (New_Subp) = Chars (Alias (New_Subp)) then Set_Requires_Overriding (New_Subp); end if; |