comp.lang.ada
 help / color / mirror / Atom feed
From: mcculley@greatwall.cctt.com (Gene McCulley)
Subject: defaults on discriminants
Date: 15 Nov 1994 22:54:24 GMT
Date: 1994-11-15T22:54:24+00:00	[thread overview]
Message-ID: <3abe70$o5d@babyblue.cs.yale.edu> (raw)

The following compiles fine under LegacyAda 1.4.0 and GNAT but does not under
Rational Apex 1.4.1 on the RS/6000:

procedure Dummytest is

    type Integer_Array is array (Natural range <>) of Integer;

    type Foo_Record_Type (Count1 : Natural := 1) is
        record
            Things : Integer_Array (1 .. Count1);
    end record;

    My_Foo : Foo_Record_Type (5);
begin
    My_Foo.Things (1) := 5;
end Dummytest;

!!! [MID] Program will raise CONSTRAINT_ERROR (Range_Error) at "type
FOO_RECORD_TYPE (COUNT1 : NATURAL := 1) is " (DUMMYTEST'BODY.2D)

The Apex generated executable says:
Exception CONSTRAINT_ERROR (Range_Error) raised
and then shows the type definition for Foo_Record_Type in the debugger.

Apex compiles this fine if I give no default for the discriminant.
Shouldn't I be able to give it a default?



             reply	other threads:[~1994-11-15 22:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-11-15 22:54 Gene McCulley [this message]
1994-11-20 17:14 ` defaults on discriminants Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox