The compiler incorrectly accepts Some_Object'Unchecked_Access'Image.
gcc/ada/
* sem_attr.adb
(Analyze_Image_Attribute.Check_Image_Type): Check for
E_Access_Attribute_Type prefix type.
then
Error_Msg_Ada_2022_Feature ("nonscalar ''Image", Sloc (P));
Error_Attr;
+
+ elsif Present (Image_Type)
+ and then Ekind (Image_Type) = E_Access_Attribute_Type
+ then
+ -- reject Some_Object'[Unchecked_]Access'[Wide_[Wide_]]Image
+ Error_Msg_N ("illegal Image attribute prefix", N);
+ Error_Attr;
end if;
end Check_Image_Type;