]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Further refine 'Super attribute
authorJustin Squirek <squirek@adacore.com>
Thu, 11 Apr 2024 22:05:30 +0000 (22:05 +0000)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 10 Jun 2024 09:04:00 +0000 (11:04 +0200)
This patch adds the restriction on 'Super such that it cannot apply to objects
whose parent type is an interface.

gcc/ada/

* sem_attr.adb (Analyze_Attribute): Add check for interface parent
types.

gcc/ada/sem_attr.adb

index 4fd270aeae9c21b83496be8f683855d8fd5362fd..2fd95f36d65cbe3677abab39df99904f4e1c1fb9 100644 (file)
@@ -6683,6 +6683,12 @@ package body Sem_Attr is
             elsif Depends_On_Private (P_Type) then
                Error_Attr_P ("prefix type of % is a private extension");
 
+            --  Disallow view conversions to interfaces in order to avoid
+            --  depending on whether an interface type is used as a parent
+            --  or progenitor type.
+
+            elsif Is_Interface (Node (First_Elmt (Parents))) then
+               Error_Attr_P ("type of % cannot be an interface");
             end if;
 
             --  Generate a view conversion and analyze it