PR ipa/83051
[official-gcc.git] / gcc / testsuite / gnat.dg / pointer_controlled.adb
blob1d85b53fec341cd57aabd086fdc5ee45adf97b4b
1 -- PR ada/49732
2 -- Testcase by Vorfeed Canal
4 -- { dg-do compile }
5 -- { dg-options "-gnato" }
7 with Interfaces.C; use Interfaces.C;
8 with Interfaces.C.Strings; use Interfaces.C.Strings;
9 with Interfaces.C.Pointers;
11 procedure Pointer_Controlled is
13 function Create (Name : String) return size_t is
15 type Name_String is new char_array (0 .. Name'Length);
16 type Name_String_Ptr is access Name_String;
17 pragma Controlled (Name_String_Ptr);
19 Name_Str : constant Name_String_Ptr := new Name_String;
20 Name_Len : size_t;
22 begin
23 To_C (Name, Name_Str.all, Name_Len);
24 return 1;
25 end;
27 Test : size_t;
29 begin
30 Test := Create("ABC");
31 end;