aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSteve Baird <baird@adacore.com>2024-08-06 14:44:54 -0700
committerMarc Poulhiès <dkm@gcc.gnu.org>2024-08-23 10:51:05 +0200
commit7dd9c7d1293ad16708748f617e10263e4ee88a39 (patch)
treebe5a2217156015c7c44aef8f1f49760a08c96afb /gcc
parent24c5396f8cd6e93010612f09fb77845559e30692 (diff)
downloadgcc-7dd9c7d1293ad16708748f617e10263e4ee88a39.zip
gcc-7dd9c7d1293ad16708748f617e10263e4ee88a39.tar.gz
gcc-7dd9c7d1293ad16708748f617e10263e4ee88a39.tar.bz2
ada: Implicit_Dereference aspect specification for subtype incorrectly accepted
Implicit_Dereference is a type-specific aspect and therefore cannot be legally specified as part of a subtype declaration. gcc/ada/ * sem_ch13.adb (Analyze_Aspect_Implicit_Dereference): Generate error if an aspect specification specifies the Implicit_Dereference aspect of a non-first subtype.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_ch13.adb5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 0546aa3..a55ba3c 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -1982,6 +1982,11 @@ package body Sem_Ch13 is
Error_Msg_N
("aspect must apply to a type with discriminants", Expr);
+ elsif not Is_First_Subtype (E) then
+ Error_Msg_N
+ ("aspect not specifiable in a subtype declaration",
+ Aspect);
+
elsif not Is_Entity_Name (Expr) then
Error_Msg_N
("aspect must name a discriminant of current type", Expr);