diff options
author | Ed Schonberg <schonberg@adacore.com> | 2021-08-12 10:39:21 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-10-01 06:13:38 +0000 |
commit | 1c37d1960adf1c30fa700b89d588182c84f8f22d (patch) | |
tree | b9b460c44b739fc259cadfc2d07c7fe05a3872b2 /gcc/ada/sem_attr.adb | |
parent | 10ca293141e0e8178de6d68473bd2ac607c6348b (diff) | |
download | gcc-1c37d1960adf1c30fa700b89d588182c84f8f22d.zip gcc-1c37d1960adf1c30fa700b89d588182c84f8f22d.tar.gz gcc-1c37d1960adf1c30fa700b89d588182c84f8f22d.tar.bz2 |
[Ada] Crash on improper use of GNAT attribute Type_Key
gcc/ada/
* sem_attr.adb (Analyze_Attribute, case Type_Key): Attribute can
be applied to a formal type.
* sem_ch5.adb (Analyze_Case_Statement): If Extensions_Allowed is
not enabled, verify that the type of the expression is discrete.
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r-- | gcc/ada/sem_attr.adb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 7b6dc21..4265df6 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -6643,7 +6643,9 @@ package body Sem_Attr is Initialize (CRC); Compute_Type_Key (Entity (P)); - if not Is_Frozen (Entity (P)) then + if not Is_Frozen (Entity (P)) + and then not Is_Generic_Type (Entity (P)) + then Error_Msg_N ("premature usage of Type_Key?", N); end if; |