c++: prvalue of array type [PR111286]
[official-gcc.git] / gcc / testsuite / gnat.dg / opt28.adb
blob74a4c5c3be91c3e822c41ce8b2f661f4d79ec8c1
1 with Opt28_Pkg; use Opt28_Pkg;
3 package body Opt28 is
5 function Full_Filename (Filename : String) return String is
6 Path : constant String := "PATH";
7 Posix_Path : constant Posix_String := To_Posix (Path);
8 begin
10 declare
11 M : constant Posix_String := Value_Of (Posix_Path);
12 N : constant Posix_String (1 .. M'Length) := M;
13 Var : constant String := To_String (Str => N);
14 Start_Pos : Natural := 1;
15 End_Pos : Natural := 1;
16 begin
17 while Start_Pos <= Var'Length loop
18 End_Pos := Position (Var (Start_Pos .. Var'Length));
20 if Is_File (To_Posix (Var (Start_Pos .. End_Pos - 1) & Filename)) then
21 return Var (Start_Pos .. End_Pos - 1) & Filename;
22 else
23 Start_Pos := End_Pos + 1;
24 end if;
25 end loop;
26 end;
28 return "";
29 end;
31 end Opt28;