Size attribute

 avatar
unknown
ada
a year ago
673 B
9
Indexable
procedure Size_Test is

   subtype String_5_Type is String (1 .. 5);

   type RecA is record
      Field : String_5_Type := (others => ' ');
   end record;

   type RecB is record
      Field : String_5_Type := (others => ' ');
   end record;

   A : RecA;
   B : RecB;

begin
   pragma Compile_Time_Error (A.Field'Size /= B.Field'Size, "Ehh?!");
   pragma Compile_Time_Error (A.Field'Size /= A.Field'Size, "Ehhhhh ?!???");
   null;
end Size_Test;

----

gnatmake size_test
gcc -c size_test.adb
size_test.adb:17:44: error: condition is not known at compile time
size_test.adb:18:44: error: condition is not known at compile time
gnatmake: "size_test.adb" compilation error
Editor is loading...
Leave a Comment