aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2018-08-21 14:48:03 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-08-21 14:48:03 +0000
commit24241bd0388ec6f730788540b289da12c13a34cc (patch)
tree5be71cb8445185298b7e449e1402055a6380fb2e /gcc/ada
parent5bb9ebcbc8270bcc08f955d196ad8c1bba003ec1 (diff)
downloadgcc-24241bd0388ec6f730788540b289da12c13a34cc.zip
gcc-24241bd0388ec6f730788540b289da12c13a34cc.tar.gz
gcc-24241bd0388ec6f730788540b289da12c13a34cc.tar.bz2
[Ada] Spurious error on overriding protected function in instance
The conformance between an overriding protected operation with progenitors and the overridden interface operation requires subtype conformance; requiring equality of return types in the case of a function is too restrictive and leads to spurious errors when the return type is a generic actual. 2018-08-21 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_ch6.adb (Check_Synchronized_Overriding): The conformance between an overriding protected operation and the overridden abstract progenitor operation requires subtype conformance; requiring equality of return types in the case of a function is too restrictive and leads to spurious errors when the return type is a generic actual. gcc/testsuite/ * gnat.dg/prot6.adb, gnat.dg/prot6.ads: New testcase. From-SVN: r263731
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog9
-rw-r--r--gcc/ada/sem_ch6.adb4
2 files changed, 12 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 9804563..ff886eb 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,14 @@
2018-08-21 Ed Schonberg <schonberg@adacore.com>
+ * sem_ch6.adb (Check_Synchronized_Overriding): The conformance
+ between an overriding protected operation and the overridden
+ abstract progenitor operation requires subtype conformance;
+ requiring equality of return types in the case of a function is
+ too restrictive and leads to spurious errors when the return
+ type is a generic actual.
+
+2018-08-21 Ed Schonberg <schonberg@adacore.com>
+
* exp_ch9.adb (Expand_N_Timed_Entry_Call,
Expand_Conditional_Entry_Call): Use Reset_Scopes_Of to set
properly the scope of all entities created in blocks generated
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 2dd9d2f..2ddd3d3 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -7440,13 +7440,15 @@ package body Sem_Ch6 is
end;
-- Functions can override abstract interface functions
+ -- Return types must be subtype conformant.
elsif Ekind (Def_Id) = E_Function
and then Ekind (Subp) = E_Function
and then Matches_Prefixed_View_Profile
(Parameter_Specifications (Parent (Def_Id)),
Parameter_Specifications (Parent (Subp)))
- and then Etype (Def_Id) = Etype (Subp)
+ and then Conforming_Types (Etype (Def_Id), Etype (Subp),
+ Subtype_Conformant)
then
Candidate := Subp;