]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Flag unsupported dispatching constructor calls
authorJavier Miranda <miranda@adacore.com>
Mon, 7 Nov 2022 09:28:56 +0000 (09:28 +0000)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 14 Nov 2022 13:46:51 +0000 (14:46 +0100)
gcc/ada/

* exp_intr.adb
(Expand_Dispatching_Constructor_Call): Improve warning message.
* freeze.adb
(Check_No_Parts_Violations): Improve error message.

gcc/ada/exp_intr.adb
gcc/ada/freeze.adb

index cb9b5be1090b0b38a5289f31168608ef9fea20f8..d18ed69eeae6aed2c1d89537e260feae85c2fa83 100644 (file)
@@ -315,9 +315,12 @@ package body Exp_Intr is
             Error_Msg_N
               ("unsupported dispatching constructor call if the type "
                & "of the built object has task components??", N);
-            Error_Msg_N
-              ("\work around this problem by replacing task components "
-               & "with access-to-task-type components??", N);
+
+            Error_Msg_Sloc := Sloc (Root_Type (Etype (Entity (Name (N)))));
+            Error_Msg_NE
+              ("\work around this by adding ''with no_task_parts'' to "
+               & "the declaration of the root type& defined#???",
+               N, Root_Type (Etype (Entity (Name (N)))));
          end if;
       end if;
 
index 032c73d3dfba6087982d037d051bad5918db806f..7f78b4315a840e5a1fe0a9fa169ec7b9b496f9a0 100644 (file)
@@ -3188,6 +3188,9 @@ package body Freeze is
                if Has_Task (Typ) then
                   Error_Msg_N
                     ("aspect % applied to task type &", Typ);
+                  Error_Msg_N
+                    ("\replace task components with access-to-task-type "
+                     & "components??", Typ);
                end if;
 
             else