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] Interface type conversions are not dynamically tagged


A view conversion to an interface type is expanded into a dereference of a
temporary that involves the class-wide interface type. Nevertheless such an
expression is not dynamically tagged, and is not a controlling argument in 
a call.

Compiling main.adb must be rejected with:

   main.adb:8:10: call to abstract procedure must be dispatching

---
with Types; use Types;
procedure Main is
    V : R;
begin
    I (V).P1;
    I'Class (V).P1;
    I (V).P2;
    I'Class (V).P2;
end Main;
---
package Types  is
  type I is interface;

   procedure P1 (V : I)  is null;
   procedure P2 (V : I) is abstract;

   type R is new I with null record;

   procedure P2 (V : R) is null;
end Types;

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

2011-09-05  Ed Schonberg  <schonberg@adacore.com>

	* sem_disp.adb (Find_Controlling_Arg): Add checks for
	interface type conversions, that are expanded into dereferences.

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]