public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-1510] [Ada] Mixing of positional and named entries allowed in enum rep
@ 2021-06-16 8:45 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-06-16 8:45 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e66167fb494aa8839a8ef3fc283adc447718d514
commit r12-1510-ge66167fb494aa8839a8ef3fc283adc447718d514
Author: Justin Squirek <squirek@adacore.com>
Date: Sat Feb 27 14:16:32 2021 -0500
[Ada] Mixing of positional and named entries allowed in enum rep
gcc/ada/
* sem_ch13.adb (Analyze_Enumeration_Representation_Clause): Add
check for the mixing of entries.
Diff:
---
gcc/ada/sem_ch13.adb | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 4fa17f1ddb4..3c3e35150e9 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -7999,6 +7999,15 @@ package body Sem_Ch13 is
("extra parentheses surrounding aggregate not allowed", Aggr);
return;
+ -- Reject the mixing of named and positional entries in the aggregate
+
+ elsif Present (Expressions (Aggr))
+ and then Present (Component_Associations (Aggr))
+ then
+ Error_Msg_N ("cannot mix positional and named entries in "
+ & "enumeration rep clause", N);
+ return;
+
-- All tests passed, so set rep clause in place
else
@@ -8013,7 +8022,7 @@ package body Sem_Ch13 is
Elit := First_Literal (Enumtype);
- -- First the positional entries if any
+ -- Process positional entries
if Present (Expressions (Aggr)) then
Expr := First (Expressions (Aggr));
@@ -8042,11 +8051,10 @@ package body Sem_Ch13 is
Next (Expr);
Next (Elit);
end loop;
- end if;
- -- Now process the named entries if present
+ -- Process named entries
- if Present (Component_Associations (Aggr)) then
+ elsif Present (Component_Associations (Aggr)) then
Assoc := First (Component_Associations (Aggr));
while Present (Assoc) loop
Choice := First (Choices (Assoc));
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-16 8:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-16 8:45 [gcc r12-1510] [Ada] Mixing of positional and named entries allowed in enum rep Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).