+2019-08-14 Bob Duff <duff@adacore.com>
+
+ * inline.adb (Check_And_Split_Unconstrained_Function): Ignore
+ protected functions to get rid of spurious error. The
+ transformation done by this procedure triggers legality errors
+ in the generated code in this case.
+
2019-08-14 Bob Duff <duff@adacore.com>
* sem_prag.adb (Process_Compile_Time_Warning_Or_Error): Defer
Original_Body : Node_Id;
Body_To_Analyze : Node_Id;
+ -- Start of processing for Build_Body_To_Inline
+
begin
pragma Assert (Current_Scope = Spec_Id);
elsif Present (Body_To_Inline (Decl)) then
return;
+ -- Do not generate a body to inline for protected functions, because the
+ -- transformation generates a call to a protected procedure, causing
+ -- spurious errors. We don't inline protected operations anyway, so
+ -- this is no loss. We might as well ignore intrinsics and foreign
+ -- conventions as well -- just allow Ada conventions.
+
+ elsif not (Convention (Spec_Id) = Convention_Ada
+ or else Convention (Spec_Id) = Convention_Ada_Pass_By_Copy
+ or else Convention (Spec_Id) = Convention_Ada_Pass_By_Reference)
+ then
+ return;
+
-- Check excluded declarations
elsif Present (Declarations (N))
+2019-08-14 Bob Duff <duff@adacore.com>
+
+ * gnat.dg/inline19.adb, gnat.dg/inline19.ads: New testcase.
+
2019-08-14 Gary Dismukes <dismukes@adacore.com>
* gnat.dg/equal11.adb, gnat.dg/equal11_interface.ads,
--- /dev/null
+-- { dg-do compile }
+-- { dg-options "-O2" }
+
+package body Inline19 is
+
+ S : String := "Hello";
+
+ protected body P is
+ function F return String is
+ begin
+ return Result : constant String := S do
+ null;
+ end return;
+ end F;
+ end P;
+
+end Inline19;