diff options
author | Javier Miranda <miranda@adacore.com> | 2023-01-27 13:19:25 +0000 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-05-16 10:30:58 +0200 |
commit | b979a474167624bf658fd30a23e99f087d7c6e0a (patch) | |
tree | 07b981ee942e77da27b433d3aa7ce3a68d10decd /gcc | |
parent | b358f011bde393ee602d756ec19a5d1ceb181a72 (diff) | |
download | gcc-b979a474167624bf658fd30a23e99f087d7c6e0a.zip gcc-b979a474167624bf658fd30a23e99f087d7c6e0a.tar.gz gcc-b979a474167624bf658fd30a23e99f087d7c6e0a.tar.bz2 |
ada: Spurious error on function returning CPP type
gcc/ada/
* exp_ch6.adb
(Needs_BIP_Alloc_Form): Return False for functions with foreign
convention since we never use build-in-place for such functions.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/exp_ch6.adb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index af7f753..b8e5a72 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -9435,9 +9435,14 @@ package body Exp_Ch6 is -- types, and those can be used to call primitives, so the formal needs -- to be passed to all such build-in-place functions, primitive or not. + -- We never use build-in-place if the function has foreign convention, + -- but note that it is OK for a build-in-place function to return a + -- type with a foreign convention because the machinery ensures there + -- is no copying. + return not Restriction_Active (No_Secondary_Stack) and then (Needs_Secondary_Stack (Typ) or else Is_Tagged_Type (Typ)) - and then not Has_Foreign_Convention (Typ); + and then not Has_Foreign_Convention (Func_Id); end Needs_BIP_Alloc_Form; ------------------------------------- |