diff options
author | Ed Schonberg <schonberg@adacore.com> | 2014-02-25 15:50:32 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-02-25 16:50:32 +0100 |
commit | 2886a49530f3c37c1265224a4f5a63ab91a3bd19 (patch) | |
tree | ee8286df4b8167145b18a1cf5aef85e5686267c9 /gcc | |
parent | fb12497dfee7a3bc428724f603c0100113b211ce (diff) | |
download | gcc-2886a49530f3c37c1265224a4f5a63ab91a3bd19.zip gcc-2886a49530f3c37c1265224a4f5a63ab91a3bd19.tar.gz gcc-2886a49530f3c37c1265224a4f5a63ab91a3bd19.tar.bz2 |
sem_ch3.adb (Process_Full_View): Better error message when the full view of a private type without...
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ada/sem_ch3.adb | 15 | ||||
-rw-r--r-- | gcc/ada/sem_ch7.adb | 8 |
3 files changed, 25 insertions, 5 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 7aef153..6863929 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -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. diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 5020b59..b6d22cb 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -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; diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb index f5d146f..de1a28a 100644 --- a/gcc/ada/sem_ch7.adb +++ b/gcc/ada/sem_ch7.adb @@ -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 |