]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
sem_ch3.adb (Process_Full_View): Better error message when the full view of a private...
authorEd Schonberg <schonberg@adacore.com>
Tue, 25 Feb 2014 15:50:32 +0000 (15:50 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 25 Feb 2014 15:50:32 +0000 (16:50 +0100)
2014-02-25  Ed Schonberg  <schonberg@adacore.com>

* sem_ch3.adb (Process_Full_View): Better error message when
the full view of  a private type without discriminants is an
unconstrained type.
* sem_ch7.adb (Uninstall_Declarations): Ditto.

From-SVN: r208147

gcc/ada/ChangeLog
gcc/ada/sem_ch3.adb
gcc/ada/sem_ch7.adb

index 7aef15360e2f66a2e11139395dcc56540cff6c26..68639291468b295b2092c43e343525e9ad89aa43 100644 (file)
@@ -1,3 +1,10 @@
+2014-02-25  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch3.adb (Process_Full_View): Better error message when
+       the full view of  a private type without discriminants is an
+       unconstrained type.
+       * sem_ch7.adb (Uninstall_Declarations): Ditto.
+
 2014-02-25  Eric Botcazou  <ebotcazou@adacore.com>
 
        * sigtramp-armvxw.c: Also restore r0.
index 5020b59a55c26986f7f8073487cd0f3bc62eba6e..b6d22cb50cc57fad571a63125d623d134b0e24cb 100644 (file)
@@ -18471,13 +18471,22 @@ package body Sem_Ch3 is
          end if;
 
       else
-         --  For untagged types, verify that a type without discriminants
-         --  is not completed with an unconstrained type.
+         --  For untagged types, verify that a type without discriminants is
+         --  not completed with an unconstrained type. A separate error message
+         --  is produced if the full type has defaulted discriminants.
 
          if not Is_Indefinite_Subtype (Priv_T)
            and then Is_Indefinite_Subtype (Full_T)
          then
-            Error_Msg_N ("full view of type must be definite subtype", Full_T);
+            Error_Msg_Sloc := Sloc (Parent (Priv_T));
+            Error_Msg_NE
+              ("full view of& not compatible with declaration#",
+               Full_T, Priv_T);
+
+            if not Is_Tagged_Type (Full_T) then
+               Error_Msg_N
+                 ("\one is constrained, the other unconstrained", Full_T);
+            end if;
          end if;
       end if;
 
index f5d146ffe00f991a0810a4ed56fc36fe9d4fabf9..de1a28a4c5378f32ecb2b5d6eaeaa96cef69b17d 100644 (file)
@@ -2611,11 +2611,15 @@ package body Sem_Ch7 is
 
             Set_Is_Potentially_Use_Visible (Id, In_Use (P));
 
+            --  The following test may be redundant, as this is already
+            --  diagnosed in sem_ch3. ???
+
             if  Is_Indefinite_Subtype (Full)
               and then not Is_Indefinite_Subtype (Id)
             then
-               Error_Msg_N
-                 ("full view of type must be definite subtype", Full);
+               Error_Msg_Sloc := Sloc (Parent (Id));
+               Error_Msg_NE
+                 ("full view of& not compatible with declaration#", Full, Id);
             end if;
 
             --  Swap out the subtypes and derived types of Id that