This recent regression occurs when the nominal subtype of the constant is a
discriminated record type with default discriminants.
gcc/ada/
PR ada/110488
* sem_ch3.adb (Analyze_Object_Declaration): Do not build a default
subtype for a deferred constant in the definite case too.
Apply_Length_Check (E, T);
end if;
- -- When possible, build the default subtype
+ -- When possible, and not a deferred constant, build the default subtype
- elsif Build_Default_Subtype_OK (T) then
+ elsif Build_Default_Subtype_OK (T)
+ and then (not Constant_Present (N) or else Present (E))
+ then
if No (E) then
Act_T := Build_Default_Subtype (T, N);
else