(Debian bug #284333) -- RM 10.2.1(10): A generic body is preelaborable only if elaboration -- of a corresponding instance body would not perform any such actions -- [assuming the worst about possible actual generic parameters] -- AARM 12.3(1.a): The legality of an instance should be determinable -- without looking at the generic body. Likewise, the legality of a -- generic body should be determinable without looking at any instances. generic x1: integer; package Test_135 is pragma Preelaborate; pragma Elaborate_Body; end Test_135; package body Test_135 is x2: integer := x1; -- ERROR: not preelaborable end Test_135; The compiler is silent; I expect an error message like: test_135.adb:3:18: object in preelaborated unit has non-static default gnatmake: "test_135.adb" compilation error
Confirmed.
We now get: $ gcc -c test_135.adb test_135.adb:3:19: non-static object name in preelaborated unit test_135.adb:3:19: "x1" is not static constant or named number (RM 4.9(5)) Arno