Commit 62f0fa21 by Eric Botcazou Committed by Pierre-Marie de Rodat

[Ada] Improve error message for Object_Size clause on dynamic array

This makes the compiler issue the same error:

    size clause not allowed for variable length type

for an Object_Size clause on a variable-sized type as for a Size clause,
for example on the following procedure:

procedure P (X, Y : Integer) is
   subtype Sub is String (X .. Y) with Object_Size => 64;
begin
   null;
end;

2019-08-12  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* freeze.adb (Freeze_Entity): Give the same error for an
	Object_Size clause on a variable-sized type as for a Size
	clause.

From-SVN: r274294
parent 651c9c1e
2019-08-12 Eric Botcazou <ebotcazou@adacore.com>
* freeze.adb (Freeze_Entity): Give the same error for an
Object_Size clause on a variable-sized type as for a Size
clause.
2019-08-12 Gary Dismukes <dismukes@adacore.com> 2019-08-12 Gary Dismukes <dismukes@adacore.com>
* sem_prag.adb (Analyze_Pragma, Pragma_Suppress_Initialization): * sem_prag.adb (Analyze_Pragma, Pragma_Suppress_Initialization):
......
...@@ -6803,7 +6803,7 @@ package body Freeze is ...@@ -6803,7 +6803,7 @@ package body Freeze is
-- Do not allow a size clause for a type which does not have a size -- Do not allow a size clause for a type which does not have a size
-- that is known at compile time -- that is known at compile time
if Has_Size_Clause (E) if (Has_Size_Clause (E) or else Has_Object_Size_Clause (E))
and then not Size_Known_At_Compile_Time (E) and then not Size_Known_At_Compile_Time (E)
then then
-- Suppress this message if errors posted on E, even if we are -- Suppress this message if errors posted on E, even if we are
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment