Commit 1543e3ab by Ed Schonberg Committed by Arnaud Charlet

re PR ada/17985 (GNAT accepts extension aggregate where expexted type is not extension)

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

	* sem_aggr.adb: Update comments.
	Improve previous change for PR ada/17985

From-SVN: r135636
parent 73c25d9b
...@@ -2113,7 +2113,7 @@ package body Sem_Aggr is ...@@ -2113,7 +2113,7 @@ package body Sem_Aggr is
function Valid_Ancestor_Type return Boolean; function Valid_Ancestor_Type return Boolean;
-- Verify that the type of the ancestor part is a non-private ancestor -- Verify that the type of the ancestor part is a non-private ancestor
-- of the expected type. -- of the expected type, which must be a type extension.
---------------------------- ----------------------------
-- Valid_Limited_Ancestor -- -- Valid_Limited_Ancestor --
...@@ -2159,8 +2159,8 @@ package body Sem_Aggr is ...@@ -2159,8 +2159,8 @@ package body Sem_Aggr is
Imm_Type := Etype (Base_Type (Imm_Type)); Imm_Type := Etype (Base_Type (Imm_Type));
end loop; end loop;
if Etype (Imm_Type) /= Base_Type (A_Type) if not Is_Derived_Type (Base_Type (Typ))
or else Base_Type (Typ) = Base_Type (A_Type) or else Etype (Imm_Type) /= Base_Type (A_Type)
then then
Error_Msg_NE ("expect ancestor type of &", A, Typ); Error_Msg_NE ("expect ancestor type of &", A, Typ);
return False; return False;
......
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