public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] ada: Spurious error on nested call using the prefix notation
@ 2022-12-06 14:02 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2022-12-06 14:02 UTC (permalink / raw)
  To: gcc-patches; +Cc: Javier Miranda

From: Javier Miranda <miranda@adacore.com>

gcc/ada/

	* exp_ch6.adb
	(Build_Static_Check_Helper_Call): Perform implicit type conversion
	to ensure matching types and avoid reporting spurious errors.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/exp_ch6.adb | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index 7555bf5dcf5..c026b63fcf6 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -7552,9 +7552,10 @@ package body Exp_Ch6 is
 
             Remove_Side_Effects (A);
 
-            if Is_Controlling_Actual (A)
-              and then Etype (F) /= Etype (A)
-            then
+            --  Ensure matching types to avoid reporting spurious errors since
+            --  the called helper may have been built for a parent type.
+
+            if Etype (F) /= Etype (A) then
                Append_To (Actuals,
                  Unchecked_Convert_To (Etype (F), New_Copy_Tree (A)));
             else
-- 
2.34.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-06 14:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-06 14:02 [COMMITTED] ada: Spurious error on nested call using the prefix notation Marc Poulhiès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).