From: Steve Baird Date: Tue, 6 Aug 2024 21:44:54 +0000 (-0700) Subject: ada: Implicit_Dereference aspect specification for subtype incorrectly accepted X-Git-Tag: basepoints/gcc-16~6440 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7dd9c7d1293ad16708748f617e10263e4ee88a39;p=thirdparty%2Fgcc.git 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 --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);