https://gcc.gnu.org/g:7dd9c7d1293ad16708748f617e10263e4ee88a39
commit r15-3113-g7dd9c7d1293ad16708748f617e10263e4ee88a39 Author: Steve Baird <ba...@adacore.com> Date: Tue Aug 6 14:44:54 2024 -0700 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. Diff: --- gcc/ada/sem_ch13.adb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 0546aa37de78..a55ba3c7bd9a 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);