(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

-- 
           Summary: Illegal program accepted, RM 10.2.1(10), 12.3(1.a)
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ludovic dot brenta at insalien dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18846

Reply via email to