Size attribute issue

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
mail@pastecode.io avatar
unknown
ada
2 months ago
448 B
2
Indexable
Never
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;
Leave a Comment