[Ada] Fix assertion failure on double rederivation of private type

Pierre-Marie de Rodat derodat@adacore.com
Fri Jun 5 12:23:38 GMT 2020

As shown by the testcase, Build_Derived_Private_Type still does not
handle properly multiple rederivations of a private type initially
derived as a completion.

In order to address this, this changes factors out the retrieval of
the full and underlying full views of the parent type into an helper
function and uses it throughout the procedure.

It also deals with derivations from completions of derived private
types (as opposed to derivations from their private view).

Tested on x86_64-pc-linux-gnu, committed on trunk

2020-06-05  Eric Botcazou  <ebotcazou@adacore.com>


	* sem_ch3.adb (Available_Full_View): New function returning
	either the full or the underlying full view.
	(Build_Full_Derivation): Add guard for the full view.
	(Copy_And_Build): Retrieve the underlying full view, if any,
	also if deriving a completion.
	(Build_Derived_Private_Type): Use Available_Full_View throughout
	to decide whether a full derivation must be done.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 5568 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200605/11274a70/attachment-0001.bin>

More information about the Gcc-patches mailing list