diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 6f096266d009..d12064c25d5b 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2018-07-31 Bob Duff + + * sem_res.adb (Resolve_Allocator): Do not complain about the + implicit allocator that occurs in the expansion of a return + statement for a build-in-place function. + 2018-07-20 Martin Sebor PR middle-end/82063 diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index b45e917a308b..659b1efc6dd6 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -5035,9 +5035,14 @@ package body Sem_Res is end; end if; - -- Check for allocation from an empty storage pool + -- Check for allocation from an empty storage pool. But do not complain + -- if it's a return statement for a build-in-place function, because the + -- allocator is there just in case the caller uses an allocator. If the + -- caller does use an allocator, it will be caught at the call site. - if No_Pool_Assigned (Typ) then + if No_Pool_Assigned (Typ) + and then not Alloc_For_BIP_Return (N) + then Error_Msg_N ("allocation from empty storage pool!", N); -- If the context is an unchecked conversion, as may happen within an