c++: prvalue of array type [PR111286]
[official-gcc.git] / gcc / testsuite / gnat.dg / renaming15.adb
bloba0b13cdea81054025a663b4bbaa1d86fe404742b
1 -- { dg-do compile }
3 with Ada.Containers.Hashed_Maps;
4 with Ada.Text_IO;
6 procedure Renaming15 is
7 use Ada.Containers;
9 subtype String_T is String (1 .. 3);
11 function Hash (Aircraft_Id : Integer) return Hash_Type is
12 (Hash_Type (Aircraft_Id) * (2 ** 31 - 1));
13 function Equal (Left, Right : Integer) return Boolean is (Left = Right);
14 package Radar_Map is new Hashed_Maps (Integer, String_T, Hash, Equal);
16 Radars : Radar_Map.Map;
18 procedure Change_Elem_Value is
19 begin
20 for C in Radars.Iterate loop
21 declare
22 E : String_T renames Radar_Map.Element (C);
23 begin
24 E := "Xyz"; -- { dg-error "left hand side of assignment must be a variable" }
25 Ada.Text_IO.Put_Line (E);
26 end;
27 end loop;
28 end Change_Elem_Value;
29 begin
30 Radars.Include (1, "jjj");
31 Change_Elem_Value;
32 end Renaming15;