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] Wrong resolution of intrinsic in postcondition


This patch ensures that intrinsic operators that act as generic actuals are
properly resolved and rewritten in the instance when the context is a fully
analyzed and expanded pre/postcondition. Prior to this change the rewriting
guard was too restrictive and led to erroneous resolution.

------------
-- Source --
------------

--  g.ads

generic
   with function "<" (L, R : Integer) return Boolean;

package G is
   function Foo (L, R : Integer) return Boolean is (L < R)
     with Post => Foo'Result = (L < R);
end G;

--  main.adb

with G;

procedure Main is
   package I is new G (">");

   Result : constant Boolean := I.Foo (1, 2);

begin
   null;
end Main;

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

2016-04-20  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_res.adb (Rewrite_Renamed_Operator): Do not rewrite the
	renamed operator when the associated node appears within a
	pre/postcondition.
	* sem_util.ads, sem_util.adb (In_Pre_Post_Condition): New routine.

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]