Skip to content
Snippets Groups Projects
Commit ae250f9e authored by Eric Botcazou's avatar Eric Botcazou Committed by Marc Poulhiès
Browse files

ada: Fix internal error on aggregates of self-referencing types

The front-end contains a specific mechanism to deal with aggregates of
self-referencing types by means of the Has_Self_Reference flag, which is
supposed to be set during semantic analysis and used during expansion.

The problem is that the first part overlooks aggregates of derived types
which implicitly contain references to an ancestor type (the second part
uses a broader condition but it is effectively guarded by the first one).

This changes both parts to use the same condition based on the Is_Ancestor
predicate, which seems to implement the expected semantic in this case.

gcc/ada/
	* sem_type.ads (Is_Ancestor): Remove mention of tagged type.
	* exp_aggr.adb: Add with and use clauses for Sem_Type.
	(Build_Record_Aggr_Code.Replace_Type): Call Is_Ancestor to spot
	self-references to the type of the aggregate.
	* sem_aggr.adb (Resolve_Record_Aggregate.Add_Discriminant_Values):
	Likewise.
parent 6c431c90
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment