sem_prag.adb (Analyze_PPC_In_Decl_Part): For a class-wide condition...
authorEd Schonberg <schonberg@adacore.com>
Fri, 5 Jul 2013 08:59:49 +0000 (08:59 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 5 Jul 2013 08:59:49 +0000 (10:59 +0200)
2013-07-05  Ed Schonberg  <schonberg@adacore.com>

* sem_prag.adb (Analyze_PPC_In_Decl_Part): For a class-wide
condition, when replacing the name of a formal by a conversion
to the class-wide type, exempt selector names that appear in
parameter associations.

From-SVN: r200689

gcc/ada/ChangeLog
gcc/ada/sem_prag.adb

index 4122896c915ad87b8fc6fb1da550a7bf33e78e61..cc6e97c48bd4c1a5a8dec5c21192ddce8d6ea21e 100644 (file)
@@ -1,3 +1,10 @@
+2013-07-05  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_prag.adb (Analyze_PPC_In_Decl_Part): For a class-wide
+       condition, when replacing the name of a formal by a conversion
+       to the class-wide type, exempt selector names that appear in
+       parameter associations.
+
 2013-06-13  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/ada-tree.h (DECL_BY_DOUBLE_REF_P): Delete.
index e148d05bbf2e727632b3ccbb43378d463a7cfa16..0de1ebae055a7815bd2133a8ab54156c47f476d5 100644 (file)
@@ -1749,6 +1749,9 @@ package body Sem_Prag is
             --  accessparameter of type access-to-T is interpreted as having
             --  type access-to-T'Class. This ensures the expression is well-
             --  defined for a primitive subprogram of a type descended from T.
+            --  Note that this replacement is not done for selector names in
+            --  parameter associations. These carry an entity for reference
+            --  purposes, but they semantically they are just identifiers.
 
             -------------
             -- Get_ACW --
@@ -1790,6 +1793,9 @@ package body Sem_Prag is
                  and then Present (Entity (N))
                  and then Is_Formal (Entity (N))
                  and then Nkind (Parent (N)) /= N_Type_Conversion
+                 and then
+                   (Nkind (Parent (N)) /= N_Parameter_Association
+                      or else N /= Selector_Name (Parent (N)))
                then
                   if Etype (Entity (N)) = T then
                      Typ := Class_Wide_Type (T);