Corrected date in changelog
[official-gcc.git] / gcc / testsuite / gnat.dg / warn4.adb
blob94147c1e6f5aee54953eb8aa7fd33f48d46fa6af
1 -- { dg-do compile }
2 -- { dg-options "-O2" }
4 with Unchecked_Conversion;
6 procedure Warn4 is
8 type POSIX_Character is new Standard.Character;
9 type POSIX_String is array (Positive range <>) of aliased POSIX_Character;
11 type String_Ptr is access all String;
12 type POSIX_String_Ptr is access all POSIX_String;
14 function sptr_to_psptr is new Unchecked_Conversion -- { dg-warning "aliasing problem" }
15 (String_Ptr, POSIX_String_Ptr); -- { dg-warning "" "" { target *-*-* } 14 }
17 function To_POSIX_String (Str : String) return POSIX_String;
18 function To_POSIX_String (Str : String)
19 return POSIX_String is
20 begin
21 return sptr_to_psptr (Str'Unrestricted_Access).all;
22 end To_POSIX_String;
24 A : Boolean;
25 S : String := "ABCD/abcd";
26 P : Posix_String := "ABCD/abcd";
28 begin
29 A := To_POSIX_String (S) = P;
30 end;