[Ada] Warn when interfaces swapped between full and partial view

Pierre-Marie de Rodat derodat@adacore.com
Wed Nov 10 08:58:26 GMT 2021

The following package declaration is legal but the declaration of D
leads to performing a tree transformation.  Defining D as `type D is new
B and A with null record` would be consistent with the partial view and
thus does not require any transformation.

This is helpful in the case of generic packages where we fail to
correctly transform the tree.

package E is
   type A is interface;
   type B is interface and A;
   type D is new B with private;
   type D is new A and B with null record;

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


	* sem_ch3.adb (Derived_Type_Declaration): Introduce a subprogram
	for tree transformation. If a tree transformation is performed,
	then warn that it would be better to reorder the interfaces.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 4268 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20211110/84ac4243/attachment.bin>

More information about the Gcc-patches mailing list