Commit 92d4508a by Samuel Tardieu Committed by Samuel Tardieu

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

    gcc/ada/
	PR ada/17985
	* sem_aggr.adb (Valid_Ancestor_Type): A type is not an ancestor of
	itself.

    gcc/testsuite/
	PR ada/17985
	* gnat.dg/ancestor_type.ads, gnat.dg/ancestor_type.adb: New test.

From-SVN: r134244
parent 3354f96d
2008-04-13 Samuel Tardieu <sam@rfc1149.net>
PR ada/17985
* sem_aggr.adb (Valid_Ancestor_Type): A type is not an ancestor of
itself.
2008-04-13 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* sfn_scan.adb, sfn_scan.ads, sinfo.ads,
......@@ -2159,7 +2159,9 @@ package body Sem_Aggr is
Imm_Type := Etype (Base_Type (Imm_Type));
end loop;
if Etype (Imm_Type) /= Base_Type (A_Type) then
if Etype (Imm_Type) /= Base_Type (A_Type)
or else Base_Type (Typ) = Base_Type (A_Type)
then
Error_Msg_NE ("expect ancestor type of &", A, Typ);
return False;
else
......
2008-04-13 Samuel Tardieu <sam@rfc1149.net>
PR ada/17985
* gnat.dg/ancestor_type.ads, gnat.dg/ancestor_type.adb: New test.
2008-04-12 Andrew Pinski <pinskia@gmail.com>
* gcc.target/powerpc/darwin-save-world-1.c: New test.
-- { dg-do compile }
package body Ancestor_Type is
package body B is
function make return T is
begin
return (T with n => 0); -- { dg-error "expect ancestor" }
end make;
end B;
end Ancestor_Type;
package Ancestor_Type is
type T is tagged private;
package B is
function make return T;
end B;
private
type T is tagged record
n: Natural;
end record;
end Ancestor_Type;
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