comp.lang.ada
 help / color / mirror / Atom feed
From: Ivan Levashew <octagram@bluebottle.com>
Subject: Unchecked_Union with empty variant
Date: Sun, 15 Mar 2009 19:34:36 +0600
Date: 2009-03-15T19:34:36+06:00	[thread overview]
Message-ID: <gpj045$4dc$1@octagram.motzarella.org> (raw)

[Check_Unions.adb]
~~~~~~~~
procedure Check_Unions is


type Complex_Record (Kind : Integer := 0) is record
    Constant_Part : Character;
    Constant_Part2 : Character;
    case Kind is
    when 0 =>
      Variant_Part1 : Character;
    when 1 =>
      Variant_Part2 : Character;
    when 2 =>
      Variant_Part3 : Character;
    when others =>
      null;
    end case;
end record;

pragma Unchecked_Union (Complex_Record);

begin
    null;
end Check_Unions;
~~~~~~~~

It gives an error:
C:\...ramming\GEMA-Win32API\Ada_test>gnatmake -gnat05 Check_Unions.adb
gcc -c -gnat05 check_unions.adb
check_unions.adb:14:04: Unchecked_Union may not have empty component list
gnatmake: "check_unions.adb" compilation error

What's the problem?

I can't see any words "empty" or "null" here:

http://www.adaic.com/standards/05aarm/html/AA-B-3-3.html

-- 
If you want to get to the top, you have to start at the bottom



             reply	other threads:[~2009-03-15 13:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-15 13:34 Ivan Levashew [this message]
2009-03-16 15:16 ` Unchecked_Union with empty variant Adam Beneschan
2009-03-16 21:52 ` Stephen Leake
2009-03-17  7:21   ` Ivan Levashew
  -- strict thread matches above, loose matches on Subject: below --
2009-03-15 13:10 Ivan Levashew
2009-03-15 13:02 Ivan Levashew
replies disabled

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