From: Steve Baird <ba...@adacore.com> 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. Tested on x86_64-pc-linux-gnu, committed on master. --- 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 0546aa37de7..a55ba3c7bd9 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); -- 2.45.2