1-- { dg-do run }
2
3procedure mutable1 is
4
5   type Object (Valid : Boolean := False) is record
6      case Valid is
7         when True  => Stamp : Natural;
8         when False => null;
9      end case;
10   end record;
11
12   function Dummy_Object (Should_Be_There : Boolean) Return Object is
13   begin
14      if not Should_Be_There then
15         raise Program_Error;
16      end if;
17      return Object'(Valid => False);
18   end;
19
20   procedure Check (Create_Dummy : Boolean) is
21      B : Boolean;
22   begin
23      B := Create_Dummy and then Dummy_Object (Create_Dummy).Valid;
24   end;
25
26begin
27   Check (Create_Dummy => False);
28   Check (Create_Dummy => True);
29end;
30