comp.lang.ada
 help / color / mirror / Atom feed
From: vldmr <vldmrrr@gmail.com>
Subject: Variant record assignment fails discriminant check
Date: Wed, 2 Sep 2009 07:25:11 -0700 (PDT)
Date: 2009-09-02T07:25:11-07:00	[thread overview]
Message-ID: <577dcd1b-5384-408f-abf5-440e6ebd651a@a7g2000yqo.googlegroups.com> (raw)

For the folllowing variant record:
------------------------------------------
type t_X520CommonName_Choice_Id is (
        X520CommonName_teletexString,
        X520CommonName_printableString
-- more choices
    );
type t_X520CommonName (choice_Id : t_X520CommonName_Choice_Id :=
X520CommonName_teletexString) is record -- CHOICE
    case choice_Id is
        when X520CommonName_teletexString =>
            teletexString : t_TeletexString_Acc; -- TeletexString
(SIZE (1..ub-common-name))
        when X520CommonName_printableString =>
            printableString : t_PrintableString_Acc; --
PrintableString (SIZE (1..ub-common-name))
-- ... more choices
     end case;
end record;
----------------------------------
the following code:
---------------------------------
    procedure BDec_X520CommonNameContent(tagId0 : t_Asn_Tag;v: out
t_X520CommonName;) is
    begin
        case tagId0 is
            when
                16#14000000# | -- UNIV PRIM TELETEXSTRING_TAG_CODE
                16#34000000#   -- UNIV CONS TELETEXSTRING_TAG_CODE
                =>
                declare
                    teletexString : t_TeletexString_Acc;
                begin
                    teletexString := Adr_2_t_TeletexString_Acc
( Asn1_Alloc ( t_TeletexString'Size / 8));
                    Check_Asn1_Alloc (teletexString.all'Address,
exceptProc);
                    BDec_TeletexStringContent (tagId0, elmtLen0,
teletexString.all, totalElmtsLen1, exceptProc);
                    v := (choice_Id => X520CommonName_teletexString,
teletexString => teletexString); -- CONSTRAINT_ERROR
                end;
	-- ... more choices
       end case;
    end BDec_X520CommonNameContent;
--------------------------------------
when executed produces 'discriminant check failed' error on assignment
to v.

Why is that? As far as I understand the variable v shall be mutable.
Any hint is greatly appreciated

Thanks,
Vladimir



             reply	other threads:[~2009-09-02 14:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-02 14:25 vldmr [this message]
2009-09-02 14:52 ` Variant record assignment fails discriminant check Adam Beneschan
2009-09-02 15:09   ` vldmr
2009-09-02 15:33     ` Adam Beneschan
2009-09-02 16:09       ` vldmr
2014-05-12  0:31 ` maniyazhagan
2014-05-12  0:32 ` maniyazhagan
replies disabled

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