diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-11-04 14:55:34 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-11-04 14:55:34 +0100 |
commit | 73fe16797b7cc9e9a41794780d7e448b1d4b2b1e (patch) | |
tree | c293a986ed0b8e8c3860934f1afced9d8a36d475 /gcc/ada/sem_ch5.adb | |
parent | b2ab8c33ed0041184fe3747fbad246a619883600 (diff) | |
download | gcc-73fe16797b7cc9e9a41794780d7e448b1d4b2b1e.zip gcc-73fe16797b7cc9e9a41794780d7e448b1d4b2b1e.tar.gz gcc-73fe16797b7cc9e9a41794780d7e448b1d4b2b1e.tar.bz2 |
[multiple changes]
2011-11-04 Gary Dismukes <dismukes@adacore.com>
* bindgen.adb (Gen_Elab_Calls): In the case
of the AAMP target, set elaboration entities to 1 rather than
incrementing.
2011-11-04 Ed Schonberg <schonberg@adacore.com>
* sem_ch10.adb (Install_Limited_With_Unit): To establish the
proper entities on the ancestors of a child unit that appear
in a limited_with clause, follow the unit links because the
units are not analyzed and scope information is incomplete.
2011-11-04 Eric Botcazou <ebotcazou@adacore.com>
* exp_ch4.adb (Expand_N_Selected_Component): Refine code
setting the Atomic_Sync_Required flag to detect one more case.
* exp_util.adb (Activate_Atomic_Synchronization): Refine code
setting the Atomic_Sync_Required flag to exclude more cases,
depending on the parent of the node to be examined.
2011-11-04 Bob Duff <duff@adacore.com>
* g-excact.adb: Minor: use named notation.
2011-11-04 Ed Schonberg <schonberg@adacore.com>
* sem_ch5.adb: Improve error messages for illegal iterators.
From-SVN: r180952
Diffstat (limited to 'gcc/ada/sem_ch5.adb')
-rw-r--r-- | gcc/ada/sem_ch5.adb | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index 1b0f919..2ddf1af 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -2429,8 +2429,17 @@ package body Sem_Ch5 is -- The type of the loop variable is the Iterator_Element aspect of -- the container type. - Set_Etype (Def_Id, - Entity (Find_Aspect (Typ, Aspect_Iterator_Element))); + declare + Element : constant Entity_Id := + Find_Aspect (Typ, Aspect_Iterator_Element); + begin + if No (Element) then + Error_Msg_NE ("cannot iterate over&", N, Typ); + return; + else + Set_Etype (Def_Id, Entity (Element)); + end if; + end; else -- For an iteration of the form IN, the name must denote an @@ -2440,12 +2449,18 @@ package body Sem_Ch5 is if Is_Entity_Name (Original_Node (Name (N))) and then not Is_Iterator (Typ) then - Error_Msg_N - ("name must be an iterator, not a container", Name (N)); + if No (Find_Aspect (Typ, Aspect_Iterator_Element)) then + Error_Msg_NE + ("cannot iterate over&", Name (N), Typ); + else + + Error_Msg_N + ("name must be an iterator, not a container", Name (N)); + end if; Error_Msg_NE - ("\to iterate directly over a container, write `of &`", - Name (N), Original_Node (Name (N))); + ("\to iterate directly over the elements of a container, " & + "write `of &`", Name (N), Original_Node (Name (N))); end if; -- The result type of Iterate function is the classwide type of |