Version 1.1 of acs/ac-00106.txt

Unformatted version of acs/ac-00106.txt version 1.1
Other versions for file acs/ac-00106.txt

!standard 8.5.4(5)          05-01-20 AC95-00106/01
!standard 6.3.1(7)
!class confirmation 05-01-20
!status received no action 05-01-20
!status received 04-12-01
!subject Renaming-as-body can't rename inherited subprogram

!topic Renaming-as-body can't rename inherited subprogram
!reference RM95 8.5.4(5), RM95 6.3.1(7), AARM95 6.3.1(11.d)
!from Adam Beneschan 04-12-01

The following declarations were extracted and modified slightly from a
version of PolyORB, a publicly available set of Ada packages.  The
source contained some illegal code that is not caught by some
compilers.  The latest version of PolyORB had some modifications so
that the code (or at least this part of it) is no longer illegal.
However, we thought this should be brought up to Ada-Comment, to
discuss out whether the code that the programmer attempted to write is
something that programmers might naturally want to do and thus we
should consider making it legal, or whether there are good reasons for
keeping it illegal.

    with Ada.Strings.Unbounded;
    package PolyORB.Types is
       type PString is new Ada.Strings.Unbounded.Unbounded_String;
       function To_PolyORB_String (Source : String) return PString;

       type RepositoryId is new PolyORB.Types.PString;
       pragma Inline (To_PolyORB_String);
    end PolyORB.Types;

    package CORBA is
       subtype RepositoryId is PolyORB.Types.RepositoryId;
       function To_CORBA_String (S : String) return RepositoryId;
    end CORBA;

    package body CORBA is
       function To_CORBA_String (S : String) return CORBA.RepositoryId
                    renames PolyORB.Types.To_PolyORB_String;  -- ERROR!
    end CORBA;

The last rename is illegal because it is a renaming-as-body that
renames an inherited subprogram of an untagged type, and 6.3.1(7) (and
AARM 6.3.1(11.d)) indicate that this is considered an "implicitly
declared subprogram" whose default calling convention is therefore
Intrinsic, and thus cannot be renamed with a renaming-as-body.


Questions? Ask the ACAA Technical Agent