public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Marc Poulhi?s <dkm@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3780] ada: Reject limited objects in array and record delta aggregates Date: Tue, 8 Nov 2022 08:40:44 +0000 (GMT) [thread overview] Message-ID: <20221108084044.31D813858C53@sourceware.org> (raw) https://gcc.gnu.org/g:79e02673e97d1a359ca1fc2dc3f6d51d0debe7d8 commit r13-3780-g79e02673e97d1a359ca1fc2dc3f6d51d0debe7d8 Author: Piotr Trojanek <trojanek@adacore.com> Date: Thu Oct 14 23:31:21 2021 +0200 ada: Reject limited objects in array and record delta aggregates For array delta aggregates the base expression cannot be limited; for record delta aggregates the base expression can only be limited if it is a newly constructed object. gcc/ada/ * sem_aggr.adb (Resolve_Delta_Aggregate): Implement rules related to limited objects appearing as the base expression. Diff: --- gcc/ada/sem_aggr.adb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 383f18f7301..4da05dd7317 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -3421,6 +3421,18 @@ package body Sem_Aggr is Analyze_And_Resolve (Base, Typ); if Is_Array_Type (Typ) then + -- For an array_delta_aggregate, the base_expression and each + -- expression in every array_component_association shall be of a + -- nonlimited type; RM 4.3.4(13/5). However, to prevent repeated + -- errors we only check the base expression and not array component + -- associations. + + if Is_Limited_Type (Etype (Base)) then + Error_Msg_N + ("array delta aggregate shall be of a nonlimited type", Base); + Explain_Limited_Type (Etype (Base), Base); + end if; + Resolve_Delta_Array_Aggregate (N, Typ); else @@ -3432,6 +3444,11 @@ package body Sem_Aggr is ("delta aggregates for record types must use (), not '[']", N); end if; + -- The base_expression of a record_delta_aggregate can be of a + -- limited type only if it is newly constructed; RM 7.5(2.1/5). + + Check_Expr_OK_In_Limited_Aggregate (Base); + Resolve_Delta_Record_Aggregate (N, Typ); end if;
reply other threads:[~2022-11-08 8:40 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221108084044.31D813858C53@sourceware.org \ --to=dkm@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).