[COMMITTED,06/26] ada: Type conversion in instance incorrectly rejected.

Message ID 20240802071210.413366-6-poulhies@adacore.com
State Committed
Commit a846b4cfc7383e7a2550993cbf669b94db838069
Headers
Series [COMMITTED,01/26] ada: Fix detection of suspicious loop patterns |

Commit Message

Marc Poulhiès Aug. 2, 2024, 7:11 a.m. UTC
  From: Steve Baird <baird@adacore.com>

In some cases, a legal type conversion in a generic package is correctly
accepted but the corresponding type conversion in an instance of the generic
is incorrectly rejected.

gcc/ada/

	* sem_res.adb (Valid_Conversion): Test In_Instance instead of
	In_Instance_Body.

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

---
 gcc/ada/sem_res.adb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 8a18430ff58..9a3b6ddbb53 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -14697,7 +14697,7 @@  package body Sem_Res is
 
       --  If it was legal in the generic, it's legal in the instance
 
-      elsif In_Instance_Body then
+      elsif In_Instance then
          return True;
 
       --  Ignore privacy for streaming or Put_Image routines