public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-5427] [Ada] Ada 2020 AI12-0401 Renaming of qualified expression of variable
@ 2020-11-26  8:43 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2020-11-26  8:43 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:678e19545eb22d3661d83641884f88fa5038a088

commit r11-5427-g678e19545eb22d3661d83641884f88fa5038a088
Author: Arnaud Charlet <charlet@adacore.com>
Date:   Wed Oct 28 04:55:16 2020 -0400

    [Ada] Ada 2020 AI12-0401 Renaming of qualified expression of variable
    
    gcc/ada/
    
            * sem_ch8.adb (Analyze_Object_Renaming): Check for AI12-0401.

Diff:
---
 gcc/ada/sem_ch8.adb | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 4c80e02435b..f78d31a1844 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -1038,6 +1038,22 @@ package body Sem_Ch8 is
             Mark_Ghost_Renaming (N, Entity (Nam));
          end if;
 
+         --  Check against AI12-0401 here before Resolve may rewrite Nam and
+         --  potentially generate spurious warnings.
+
+         if Nkind (Nam) = N_Qualified_Expression
+           and then Is_Variable (Expression (Nam))
+           and then not
+             (Subtypes_Statically_Match (T, Etype (Expression (Nam)))
+                or else
+              Subtypes_Statically_Match (Base_Type (T), Etype (Nam)))
+         then
+            Error_Msg_N
+              ("subtype of renamed qualified expression does not " &
+               "statically match", N);
+            return;
+         end if;
+
          Resolve (Nam, T);
 
          --  If the renamed object is a function call of a limited type,


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-26  8:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26  8:43 [gcc r11-5427] [Ada] Ada 2020 AI12-0401 Renaming of qualified expression of variable 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).