This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Untagged incomplete views completed with tagged types


If an untagged incomplete type is completed with an extension, the class_wide
type must be created for the full view. If the full view has self-referential
components of an anonymous access type, the class_wide type must be created
before the component declarations are analyzed.

Compiling the following program must yield the following warning:

   crash.ads:3:04: warning: imcomplete view of tagged type should be tagged

package Crash is
   type R;
   type T;   --   should be tagged;

   type R is tagged null record;

   type T_A is access all T;

   type T is new R with record
      Self : access T'Class;
   end record;

   function F return access T'Class;
end Crash;
---
package body Crash is
   function F return access T'Class is
      V : constant T_A := new T;
   begin
      if True then
         V.Self := F;
      end if;

      return V;
   end F;
end Crash;

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

2010-06-17  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (Build_Incomplete_Type_Declaration): If there is an
	incomplete view of the type that is not tagged, and the full type is a
	tagged extension, create class_wide type now, and warn that the
	incomplete view should be tagged as well.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]