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] |
In conversions of prefixed calls involving interfaces, the expression in the conversion may have a limited view of a type obtained transitively through several contexts. Use the non-limited view if available, to enable subsequent interface membership tests. The following must compile quietly: gcc -c rich_graph.adb --- with Edge; with Vertex; with Graph; package Rich_Graph is type Object is new Graph.Object with private; type Class_Ref is access all Object'Class; overriding function Other_End (G : in Object; E : in Edge.Class_Ref; V : in Vertex.Class_Ref) return Vertex.Class_Ref; private type Object is new Graph.Object with null record; end Rich_Graph; --- with Rich_Edge; with Rich_Vertex; package body Rich_Graph is overriding function Other_End (G : in Object; E : in Edge.Class_Ref; V : in Vertex.Class_Ref) return Vertex.Class_Ref is Rich_E : Rich_Edge.Class_Ref; Rich_V : Rich_Vertex.Class_Ref; begin Rich_E := Rich_Edge.Class_Ref (E); Rich_V := Rich_Vertex.Class_Ref (V); return Vertex.Class_Ref (Rich_E.Other_End (Rich_V)); end Other_End; end Rich_Graph; --- package Edge is type Object is limited interface; type Class_Ref is access all Object'Class; end Edge; --- package Vertex is type Object is limited interface; type Class_Ref is access all Object'Class; end Vertex; --- with Vertex; with Edge; package Graph is type Object is limited interface; type Class_Ref is access all Object'Class; function Other_End (Graph : in Object; E : in Edge.Class_Ref; V : in Vertex.Class_Ref) return Vertex.Class_Ref is abstract; end Graph; --- with Edge; limited with Rich_Vertex; package Rich_Edge is type Object is limited interface and Edge.Object; type Class_Ref is access all Object'Class; function Other_End (E : in Object; V : access Rich_Vertex.Object'Class) return Rich_Vertex.Class_Ref is abstract; end Rich_Edge; --- with Vertex; package Rich_Vertex is type Object is limited interface and Vertex.Object; type Class_Ref is access all Object'Class; end Rich_Vertex; Tested on x86_64-pc-linux-gnu, committed on trunk 2014-07-29 Ed Schonberg <schonberg@adacore.com> * sem_res.adb (Resolve_Type_Conversion): If the type of the expression is a limited view, use the non-limited view when 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] |