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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,fdbf6f8330ffcbf5,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!j25g2000yqa.googlegroups.com!not-for-mail From: Shark8 Newsgroups: comp.lang.ada Subject: Odd/Broken behavior DOTNET-GNAT vs GNAT regarding tagged types. Date: Thu, 21 Oct 2010 20:35:59 -0700 (PDT) Organization: http://groups.google.com Message-ID: <512951a6-bcc3-4c1a-a5ce-5bd3402d7143@j25g2000yqa.googlegroups.com> NNTP-Posting-Host: 174.28.203.45 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1287718559 5713 127.0.0.1 (22 Oct 2010 03:35:59 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 22 Oct 2010 03:35:59 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j25g2000yqa.googlegroups.com; posting-host=174.28.203.45; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10 ( .NET CLR 3.5.30729; .NET CLR 4.0.20506),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:15639 Date: 2010-10-21T20:35:59-07:00 List-Id: Hey everyone; I just got bit with a bit of a surprise regarding the differences in how tagged types are treated by GNAT vs DOTNET-GNAT, The output of 'external_tag shows why the behavior of the Ada.Tags Package is broken under DOTNET. Here's the source for replicating. {I'm still using the 2009 Gnat/ DOTNET-Gnat.} -- Package with tagged types. ---------------------------------------------- Package Tagged_Base_Pkg is Type Tagged_Base is Tagged Null Record; Type Tagged_Child is New Tagged_Base_Pkg.Tagged_Base with Record Some_Data : Integer:= Positive'First; End Record; End Tagged_Base_Pkg; -- Program source to replicate ---------------------------------------------- With Ada.Tags, Ada.Text_IO, Tagged_Base_Pkg; Procedure Tag_Error is Use Tagged_Base_Pkg; SubType Parent_Class is Tagged_Base'Class; SubType Child_Class is Tagged_Child'Class; A_Parent : Parent_Class:= Tagged_Base'( Others => <> ); A_Child : Child_Class:= Tagged_Child'( Others => <> ); Use Ada.Text_IO, Ada.Tags; Begin Put_Line( "External tag for base type: " & Tagged_Base'External_Tag ); Put_Line("External tag for child type: " & Tagged_Child'External_Tag ); Put_Line( "" ); Put( "Tagged child is " ); If NOT Is_Descendant_At_Same_Level ( Descendant => A_Child'Tag, Ancestor => A_Parent'Tag ) then Put("NOT "); end if; put_line( "a decendant." ); End Tag_Error; --------------------------------------------------------------- -- .NET output ---------------------- C:\PROGRA~3\TEMPOR~1\testing>tag_error.exe External tag for base type: tagged_base_pkg.tagged_base External tag for child type: tagged_base_pkg.tagged_child Tagged child is NOT a decendant. -- Native output ---------------------- C:\PROGRA~3\TEMPOR~1\testing>tag_error.exe External tag for base type: TAGGED_BASE_PKG.TAGGED_BASE External tag for child type: TAGGED_BASE_PKG.TAGGED_CHILD Tagged child is a decendant.