[Ada] Improve error message for dispatching subprogram formals
authorEd Schonberg <schonberg@adacore.com>
Thu, 12 Dec 2019 10:03:35 +0000 (10:03 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Thu, 12 Dec 2019 10:03:35 +0000 (10:03 +0000)
2019-12-12  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_ch8.adb: Improve error message for dispatching subprogram
formals.

From-SVN: r279301

gcc/ada/ChangeLog
gcc/ada/sem_ch8.adb

index 386ae097679f6e2dba2625e01c633610e4d36717..d859109a030d449a63e79ad7947c05109fca77df 100644 (file)
@@ -1,3 +1,8 @@
+2019-12-12  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch8.adb: Improve error message for dispatching subprogram
+       formals.
+
 2019-12-12  Gary Dismukes  <dismukes@adacore.com>
 
        * exp_ch9.adb (Build_Protected_Entry): Set the Scope of the new
index 38cbf1cd26bd7d2bdd21a96205399ed55c93ba66..8897b25e04657862b401d23c5962b9fd1523cf32 100644 (file)
@@ -3453,9 +3453,14 @@ package body Sem_Ch8 is
                   if Old_S_Ctrl_Type /= New_S_Ctrl_Type
                     or else No (New_S_Ctrl_Type)
                   then
-                     Error_Msg_NE
-                       ("actual must be dispatching subprogram for type&",
-                        Nam, New_S_Ctrl_Type);
+                     if No (New_S_Ctrl_Type) then
+                        Error_Msg_N
+                          ("actual must be dispatching subprogram", Nam);
+                     else
+                        Error_Msg_NE
+                          ("actual must be dispatching subprogram for type&",
+                           Nam, New_S_Ctrl_Type);
+                     end if;
 
                   else
                      Set_Is_Dispatching_Operation (New_S);