From danr@tawny.ssd.hcsc.com Mon May 12 22:44:42 1997 Return-Path: Received: from inmet.com by camb.inmet.com (SMI-8.6/SMI-SVR4) id WAA13392; Mon, 12 May 1997 22:44:42 -0400 Received: from sw-eng.falls-church.va.us by inmet.com (SMI-8.6/SMI-SVR4) id WAA10380; Mon, 12 May 1997 22:44:40 -0400 Received: from hawk.hcsc.com by sw-eng.falls-church.va.us (8.7.1/) id CAA05818; Tue, 13 May 1997 02:41:35 GMT Received: from tawny.ssd.hcsc.com by hawk.hcsc.com (5.61/harris-5.1) id AA14970; Mon, 12 May 97 22:44:37 -0400 Received: by tawny.ssd.hcsc.com (5.61/CX/UX-7.1) id AA08531; Tue, 13 May 97 02:44:36 GMT From: danr@tawny.ssd.hcsc.com (Dan Rittersdorf) Message-Id: <9705130244.AA08531@tawny.ssd.hcsc.com> Subject: designated subtype of a derived access type, again, with feeling To: ada-comment@sw-eng.falls-church.va.us Date: Mon, 12 May 1997 22:44:35 -0400 (EDT) Reply-To: Dan.Rittersdorf@mail.ccur.com X-Mailer: ELM [version 2.4 PL24] Content-Type: text content-length: 3384 !topic designated subtype of a subtype derived from an access type. !reference RM95-3.10(16) !reference RM95-4.8 !reference RM95-4.6 !from Dan Rittersdorf 97-05-12 !keywords designated subtype, access type, derived type <> !discussion An issue has been raised here at Concurrent regarding the designated subtype of a derived access type. For a particular example, consider test c34007f.ada in the 9xbasic portion of the ACVC 2.0.1 suite. At line 130, constraint_error is expected. It is not clear to me why, in light of sliding permitted by Ada95, unless I'm determining the designated subtype of T incorrectly. Consider these relevant declarations from the test: SUBTYPE COMPONENT IS INTEGER; TYPE DESIGNATED IS ARRAY (NATURAL RANGE <>) OF COMPONENT; PACKAGE PKG IS TYPE PARENT IS ACCESS DESIGNATED; END PKG; USE PKG; TYPE T IS NEW PARENT (IDENT_INT (5) .. IDENT_INT (7)); X : T := ... ; ... X := NEW DESIGNATED'(6 .. 8 => 0); This assignment statement is expected to raise constraint_error, but if I determined the designated subtype correctly, it should not. The crux of the confusion seems to be the definition of the designated subtype involved. Since T is a derived type, it isn't clear to me whether the designated subtype of T is DESIGNATED (IDENT_INT (5) .. IDENT_INT (7)) applying the constraint of the derived access type T, or just DESIGNATED because the derived type's constraint is not applied to the designated subtype, but rather it keeps the parent type's designated subtype. If the constraint of T were to apply to the designated subtype of T, then the qualified expression above having bounds 6..8 would be implicitly converted to the designated subtype, having bounds 5..7, and all would be fine. Because the RM doesn't specifically say anything about the designated subtype of a derived type (derived from an access type), and the test expects behavior implying the unconstrained designated type, I must assume that the designated subtype of the derived type is the (unconstrained) designated subtype of the parent type, "DESIGNATED". Is this the case? It's a bit strange that the designated type would not be constrained by the constraint applied to the derived type declaration, since the constraint would apply if it were a normal access type definition. On the other hand, T is NOT defined by an access_to_object_definition, or an access_definition, so RM95 3.10(16) doesn't apply to T, does it? Your comments on the matter would be much appreciated. Thank you, Daniel G. Rittersdorf Lead Software Engineer Concurrent Computer Corporation -- Dan.Rittersdorf@mail.ccur.com or RittersdorfD@ACM.org ______________________________________________________________________________ Concurrent Computer Corporation | Daniel G. Rittersdorf 2101 W. Cypress Creek Rd. | 178 Washington Street Ft. Lauderdale FL 33309 | Sparta, MI 49345-1324 Ph: +1 (954) 974-1700 | Ph: +1 (616) 887-5431 ______________________________________________________________________________