[PATCH] ada/35886: Switch location of incomplete and full declarations
Samuel Tardieu
sam@rfc1149.net
Wed Apr 9 13:40:00 GMT 2008
gcc/ada/
PR ada/35886
* sem_ch3.adb (Find_Type_Name): Switch Id and Prev in error
messages.
gcc/testsuite/
PR ada/35886
* gnat.dg/specs/tag3.ads: New.
---
gcc/ada/sem_ch3.adb | 6 +++---
gcc/testsuite/gnat.dg/specs/tag3.ads | 6 ++++++
2 files changed, 9 insertions(+), 3 deletions(-)
create mode 100644 gcc/testsuite/gnat.dg/specs/tag3.ads
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 00e471a..2bd3a4c 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -13055,7 +13055,7 @@ package body Sem_Ch3 is
if Nkind (Type_Definition (N)) = N_Record_Definition then
if not Tagged_Present (Type_Definition (N)) then
Error_Msg_NE
- ("full declaration of } must be tagged", Prev, Id);
+ ("full declaration of } must be tagged", Id, Prev);
Set_Is_Tagged_Type (Id);
Set_Primitive_Operations (Id, New_Elmt_List);
end if;
@@ -13064,14 +13064,14 @@ package body Sem_Ch3 is
if No (Record_Extension_Part (Type_Definition (N))) then
Error_Msg_NE (
"full declaration of } must be a record extension",
- Prev, Id);
+ Id, Prev);
Set_Is_Tagged_Type (Id);
Set_Primitive_Operations (Id, New_Elmt_List);
end if;
else
Error_Msg_NE
- ("full declaration of } must be a tagged type", Prev, Id);
+ ("full declaration of } must be a tagged type", Id, Prev);
end if;
end if;
diff --git a/gcc/testsuite/gnat.dg/specs/tag3.ads b/gcc/testsuite/gnat.dg/specs/tag3.ads
new file mode 100644
index 0000000..8e167e0
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/tag3.ads
@@ -0,0 +1,6 @@
+-- { dg-do compile }
+
+package tag3 is
+ type T is tagged;
+ type T is null record; -- { dg-error "must be tagged" }
+end tag3;
--
1.5.5.144.g3e42
More information about the Gcc-patches
mailing list