ADA 1.3 RTF Avatar
  1. OMG Issue

ADA13 — Insecurity about literals of typedefed enums

  • Key: ADA13-16
  • Legacy Issue Number: 5682
  • Status: closed  
  • Source: Airbus Group ( Oliver Kellogg)
  • Summary:

    Description:

    Given the declarations

    module m_a {
    enum enum_a

    { value_1, value_2 }

    ;
    };
    module m_b

    { typedef m_a::enum_a enum_b; }

    ;

    I believe the following is illegal:

    const m_b::enum_b bconst = m_b::value_2;

    Instead, to define such a constant in IDL, one needs to write

    const m_b::enum_b bconst = m_a::value_2;

    However, when mapping the typedefed enum to Ada, a derived type is
    created.
    The derived type implicitly creates visibility of the enum literals
    in the new scope (in this example, module m_b).
    Furthermore, enum_a and enum_b are not assignment-compatible in Ada.

    A clarification should be added to the Ada mapping stating that
    all mentions of scope prefixes at enum literals must be converted to
    match the Ada rules.
    Thus the above example

    const m_b::enum_b bconst = m_a::value_2;

    must be mapped as follows to Ada:

    bconst : constant m_b.enum_b := m_b.value_2;

  • Reported: ADA 1.2 — Wed, 9 Oct 2002 04:00 GMT
  • Disposition: Resolved — ADA 1.3
  • Disposition Summary:

    Accept the proposed resolution

  • Updated: Fri, 6 Mar 2015 20:57 GMT