Commit 27e6455d by Thomas Quinot Committed by Arnaud Charlet

sem_ch13.adb (Analyze_Enumeration_Representation_Clause): Reject the clause if…

sem_ch13.adb (Analyze_Enumeration_Representation_Clause): Reject the clause if the array aggregate is surrounded by parentheses.

2005-09-01  Thomas Quinot  <quinot@adacore.com>

	* sem_ch13.adb (Analyze_Enumeration_Representation_Clause): Reject the
	clause if the array aggregate is surrounded by parentheses.

From-SVN: r103880
parent 48aa1f1a
...@@ -1488,6 +1488,14 @@ package body Sem_Ch13 is ...@@ -1488,6 +1488,14 @@ package body Sem_Ch13 is
Error_Msg_N ("enumeration rep clause not allowed for this type", N); Error_Msg_N ("enumeration rep clause not allowed for this type", N);
return; return;
-- Check that the expression is a proper aggregate (no parentheses)
elsif Paren_Count (Aggr) /= 0 then
Error_Msg
("extra parentheses surrounding aggregate not allowed",
First_Sloc (Aggr));
return;
-- All tests passed, so set rep clause in place -- All tests passed, so set rep clause in place
else else
...@@ -1500,10 +1508,6 @@ package body Sem_Ch13 is ...@@ -1500,10 +1508,6 @@ package body Sem_Ch13 is
-- normal expansion activities, and a number of special semantic -- normal expansion activities, and a number of special semantic
-- rules apply (including the component type being any integer type) -- rules apply (including the component type being any integer type)
-- Badent signals that we found some incorrect entries processing
-- the list. The final checks for completeness and ordering are
-- skipped in this case.
Elit := First_Literal (Enumtype); Elit := First_Literal (Enumtype);
-- First the positional entries if any -- First the positional entries if any
...@@ -1518,9 +1522,12 @@ package body Sem_Ch13 is ...@@ -1518,9 +1522,12 @@ package body Sem_Ch13 is
Val := Static_Integer (Expr); Val := Static_Integer (Expr);
-- Err signals that we found some incorrect entries processing
-- the list. The final checks for completeness and ordering are
-- skipped in this case.
if Val = No_Uint then if Val = No_Uint then
Err := True; Err := True;
elsif Val < Lo or else Hi < Val then elsif Val < Lo or else Hi < Val then
Error_Msg_N ("value outside permitted range", Expr); Error_Msg_N ("value outside permitted range", Expr);
Err := True; Err := True;
...@@ -3124,7 +3131,7 @@ package body Sem_Ch13 is ...@@ -3124,7 +3131,7 @@ package body Sem_Ch13 is
New_Reference_To ( New_Reference_To (
Designated_Type (Etype (F)), Loc)))), Designated_Type (Etype (F)), Loc)))),
Subtype_Mark => Result_Definition =>
New_Reference_To (Etyp, Loc)); New_Reference_To (Etyp, Loc));
end Build_Spec; end Build_Spec;
......
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