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] Fix bug in handling of renaming_as_body


Tested on i686-linux. Committed on mainline.

The renamed entity in a renaming_as_body cannot be intrinsic. This
legality rule is enforced at the time the renamed body is built and
analyzed, but in a generic context the renamed body is not constructed,
and the test must be done explicitly when the renaming is analyzed.
Test and diagnostic follow:
--
generic package G is
   type Integer_Access is access Integer;
   procedure Deallocate (X : in out Integer_Access);
   pragma Inline (Deallocate);
end;
with Ada.Unchecked_Deallocation;
package body G is
   procedure Free is new Ada.Unchecked_Deallocation (Integer, Integer_Access);
   procedure Deallocate (X : in out Integer_Access) renames Free; -- ERROR
end;
--
$ gcc -c g.adb
g.adb:8:61: subprogram used in renaming_as_body cannot be intrinsic

2005-03-08  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch8.adb (Analyze_Subprogram_Renaming): In a generic, if this is
	a renaming a body, check that the renamed subprogram in not intrinsic.
	(Find_Direct_Name): If several use_visible entities hide
	each other, and the context is a predefined file compiled through
	rtsfind, keep only the entity that comes from a predefined file.

Attachment: difs.28
Description: Text document


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