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] Late creation of final lists for Taft Amenment types in a generic context


This patch adds a guard to prevent a crash when adding an implicit with_clause
for Ada.Finalization.List_Controller. in the case where the current context is
not a compilation unit body.

The following must compile quietly:

---
with Inst; 
procedure Main is
begin
   null;
end;
---
generic
  type Priv is private;
package Gen is

  Procedure Rien;
  pragma Inline (Rien);

  type T1 is new integer;
  package Iteration is
    type T is private;
  private
    type Later (D : Boolean);
    type T is access Later;
  end Iteration;

  package Second is
    type T2 is private;
  private
     type T2 is array (1..10) of Priv;
  end Second;
end Gen;
---
package body  Gen is
  Procedure Rien is begin null; end;

  package body Iteration is
    type Later (D : Boolean)  is record
      it : Float;
      it2 : Second.T2;
    end record;
  end Iteration;
end Gen;
---
with Ada.Finalization; use Ada.Finalization;
with gen;
generic
  type Temp is tagged private;
package Inst is
   type Prob is new controlled with null record;
   type Ob is tagged record
     It : Prob;
   end record;
   package List is new gen (Ob);
end Inst;

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

2009-04-29  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch7.adb (Build_Final_List): If the designated type is a Taft
	Amendment type, add the with_clause for Finalization.List_Controller
	only if the current context is a package body.

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]