From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,FROM_LOCAL_NOVOWEL,HK_RANDOM_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,f5e42181cacdac63,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!a7g2000yqo.googlegroups.com!not-for-mail From: vldmr Newsgroups: comp.lang.ada Subject: Variant record assignment fails discriminant check Date: Wed, 2 Sep 2009 07:25:11 -0700 (PDT) Organization: http://groups.google.com Message-ID: <577dcd1b-5384-408f-abf5-440e6ebd651a@a7g2000yqo.googlegroups.com> NNTP-Posting-Host: 205.175.225.24 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1251901571 20295 127.0.0.1 (2 Sep 2009 14:26:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 2 Sep 2009 14:26:11 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: a7g2000yqo.googlegroups.com; posting-host=205.175.225.24; posting-account=e5APRAkAAAA7e6WNQ_sgu3KZK7Pj5eew User-Agent: G2/1.0 X-HTTP-Via: 1.1 secproxy04.rockwellcollins.com:8080 (IWSS) X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.11) Gecko/2009061208 Iceweasel/3.0.6 (Debian-3.0.6-1),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8110 Date: 2009-09-02T07:25:11-07:00 List-Id: 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