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] |
This patch fixes a compiler crash on an attempt to assign to a record component whose type is the limited view of a classwide type. Compiling gcc -c c3a1004e.adb must yield: c3a1004e.adb:9:07: invalid use of limited view of "Department'CLASS" --- limited with C3A1004E; package C3A1004D is -- Departments type Emp_Ptr is access all C3A1004E.Employee'Class; type Department is tagged private; private subtype Dept_Name is String (1 .. 13); type T_List is array (Positive range <>) of Emp_Ptr; type Department is tagged record Id : Dept_Name := "<<Dept_Name>>"; List : T_List (1 .. 5); Tot : Natural := 0; During_Mod : Boolean := False; end record; end C3A1004D; --- package C3A1004E.Stub_Data is type C3A1004D_Department_Class_Access is access all C3A1004D.Department'Class; type Stub_Data_Type_Assign_Employee_dacb0f_a2752f is record D : C3A1004D_Department_Class_Access; end record; Stub_Data_Assign_Employee_dacb0f_a2752f : Stub_Data_Type_Assign_Employee_dacb0f_a2752f; end C3A1004E.Stub_Data; --- with C3A1004E.Stub_Data; use C3A1004E.Stub_Data; -- with C3A1004D; -- missing package body C3A1004E is procedure Assign_Employee (E : in out Employee; D : in out C3A1004D.Department'Class) is begin D := Stub_Data.Stub_Data_Assign_Employee_dacb0f_a2752f.D.all; end Assign_Employee; end C3A1004E; --- limited with C3A1004D; package C3A1004E is -- Employees type Dept_Ptr is access all C3A1004D.Department'Class; type Employee is tagged private; type Emp_Ptr is access all Employee'Class; -- used by function 'hire' procedure Assign_Employee (E : in out Employee; D : in out C3A1004D.Department'Class); private type Employee is tagged record Dept : Dept_Ptr; Id : access String; During_Mod : Boolean := False; end record; end C3A1004E; Tested on x86_64-pc-linux-gnu, committed on trunk 2015-11-18 Ed Schonberg <schonberg@adacore.com> * sem_ch5.adb (Analyze_Assignment): Diagnose assignment where left-hand side has a limited view of a class-wide type. * sem_ch6.adb (Detected_And_Exchange): Do not install a non-limited view if the scope of the type of the formal is visible through a limited_with_clause, even if the non-limited view is available.
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] |