]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Make error recovery for structural generic instantiation more robust
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 10 Sep 2025 12:31:47 +0000 (14:31 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 19 Sep 2025 09:26:11 +0000 (11:26 +0200)
This adds a guard for the case of a selected component whose prefix is an
illegal structural generic instance.

gcc/ada/ChangeLog:

* sem_ch4.adb (Analyze_Selected_Component): Bail out if the prefix
has Void_Type.

gcc/ada/sem_ch4.adb

index b0abfe4bb6b7c7029c77e46e7c226715318b9725..61a53f56a98c1fb168155459d0c58791e34f61fb 100644 (file)
@@ -5449,6 +5449,10 @@ package body Sem_Ch4 is
 
       else
          Prefix_Type := Etype (Pref);
+         if Prefix_Type = Standard_Void_Type then
+            pragma Assert (Serious_Errors_Detected > 0);
+            return;
+         end if;
       end if;
 
       if Is_Access_Type (Prefix_Type) then