diff options
Diffstat (limited to 'gcc/ada/sem_ch5.adb')
-rw-r--r-- | gcc/ada/sem_ch5.adb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index 54819b8..f3188b0 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -2257,11 +2257,17 @@ package body Sem_Ch5 is begin Typ := Etype (Iter_Name); + -- The name in the renaming declaration may be a function call. + -- Indicate that it does not come from source, to suppress + -- spurious warnings on renamings of parameterless functions, + -- a common enough idiom in user-defined iterators. + Decl := Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Id, Subtype_Mark => New_Occurrence_Of (Typ, Loc), - Name => Relocate_Node (Iter_Name)); + Name => + New_Copy_Tree (Iter_Name, New_Sloc => Loc)); Insert_Actions (Parent (Parent (N)), New_List (Decl)); Rewrite (Name (N), New_Occurrence_Of (Id, Loc)); |