Commit fe63b1b1 by Ed Schonberg Committed by Arnaud Charlet

sem_ch6.adb (Analyze_Subprogram_Specification): if the return type is abstract...

2008-05-29  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch6.adb (Analyze_Subprogram_Specification): if the return type
	is abstract, do not apply abstractness check on subprogram if this is
	a renaming declaration.

From-SVN: r136148
parent 8682d22c
...@@ -2496,21 +2496,19 @@ package body Sem_Ch6 is ...@@ -2496,21 +2496,19 @@ package body Sem_Ch6 is
May_Need_Actuals (Designator); May_Need_Actuals (Designator);
-- Ada 2005 (AI-251): In case of primitives associated with abstract -- Ada 2005 (AI-251): If the return type is abstract, verify that
-- interface types the following error message will be reported later -- the subprogram is abstract also. This does not apply to renaming
-- (see Analyze_Subprogram_Declaration). -- declarations, where abstractness is inherited.
-- In case of primitives associated with abstract interface types
-- the check is applied later (see Analyze_Subprogram_Declaration).
if Is_Abstract_Type (Etype (Designator)) if Is_Abstract_Type (Etype (Designator))
and then not Is_Interface (Etype (Designator)) and then not Is_Interface (Etype (Designator))
and then Nkind (Parent (N)) /= N_Subprogram_Renaming_Declaration
and then Nkind (Parent (N)) /= and then Nkind (Parent (N)) /=
N_Abstract_Subprogram_Declaration N_Abstract_Subprogram_Declaration
and then and then
(Nkind (Parent (N))) /= N_Formal_Abstract_Subprogram_Declaration (Nkind (Parent (N))) /= N_Formal_Abstract_Subprogram_Declaration
and then
(Nkind (Parent (N)) /= N_Subprogram_Renaming_Declaration
or else not Is_Entity_Name (Name (Parent (N)))
or else not Is_Abstract_Subprogram
(Entity (Name (Parent (N)))))
then then
Error_Msg_N Error_Msg_N
("function that returns abstract type must be abstract", N); ("function that returns abstract type must be abstract", N);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment