When the SPARK restriction mode was set, check that a declaration of
unconstrained type is allowed only for constants of type string.
Tested on x86_64-pc-linux-gnu, committed on trunk
2011-09-02 Marc Sango <[email protected]>
* sem_ch3.adb (Analyze_Object_Declaration): Change
comment and add additional check to differentiate constant of
type string from others unconstrained type.
Index: sem_ch3.adb
===================================================================
--- sem_ch3.adb (revision 178461)
+++ sem_ch3.adb (working copy)
@@ -3320,13 +3320,12 @@
-- In SPARK, a declaration of unconstrained type is allowed
-- only for constants of type string.
- -- Why no check for Comes_From_Source here, seems wrong ???
- -- Where is check to differentiate string case ???
+ if Nkind (E) = N_String_Literal then
+ Check_SPARK_Restriction
+ ("declaration of object of unconstrained type not allowed",
+ E);
+ end if;
- Check_SPARK_Restriction
- ("declaration of object of unconstrained type not allowed",
- E);
-
-- Unconstrained variables not allowed in Ada 83 mode
if Ada_Version = Ada_83