comp.lang.ada
 help / color / mirror / Atom feed
* Variant record assignment fails discriminant check
@ 2009-09-02 14:25 vldmr
  2009-09-02 14:52 ` Adam Beneschan
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: vldmr @ 2009-09-02 14:25 UTC (permalink / 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



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-05-12  0:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-02 14:25 Variant record assignment fails discriminant check vldmr
2009-09-02 14:52 ` 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

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