Ada: Fix qualified name of discriminant incorrectly accepted in constraint
The RM 3.8(12/3) subclause says that a discriminant mentioned in a
constraint must appear alone as a direct name. The last part is not
consistently checked and, while the first part is, it generates a
slightly different error message depending on the form of the input.
This fixes the last part and changes the first to use a single message.
gcc/ada/
PR ada/35793
* sem_res.adb (Check_Discriminant_Use): In a constraint context,
check that the discriminant appears alone as a direct name in all
cases and give a consistent error message when it does not.
gcc/testsuite/
* gnat.dg/specs/discr8.ads: New test.