diff options
author | Justin Squirek <squirek@adacore.com> | 2024-04-11 22:05:30 +0000 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-06-10 11:04:00 +0200 |
commit | fd5456235679be9cd00cfd8a56c73219a5fc2576 (patch) | |
tree | b55bc49884e34ea42cd63251c628ebb6b19f9501 | |
parent | d9553e44dcfc2a05d276a25c9726fbf19d78412f (diff) | |
download | gcc-fd5456235679be9cd00cfd8a56c73219a5fc2576.zip gcc-fd5456235679be9cd00cfd8a56c73219a5fc2576.tar.gz gcc-fd5456235679be9cd00cfd8a56c73219a5fc2576.tar.bz2 |
ada: Further refine 'Super attribute
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.
-rw-r--r-- | gcc/ada/sem_attr.adb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 4fd270a..2fd95f3 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -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 |