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.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Non_Primitive Operations and Object.Operation Resolution Date: Wed, 20 Apr 2016 16:59:04 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 20 Apr 2016 23:55:43 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="48b46be33beed75863f69afa437f956b"; logging-data="9823"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+4LieuoyXpmxG2ITkokFnGOJAT9PFliCg=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 X-Mozilla-News-Host: news://news.eternal-september.org:119 Cancel-Lock: sha1:HQxU2XxDZGSt1jHhQoq7Ga62klk= Xref: news.eternal-september.org comp.lang.ada:30214 Date: 2016-04-20T16:59:04-07:00 List-Id: Some pertinent code from PragmARC.Unbounded_Integers: package PragmARC.Unbounded_Integers is ... private -- PragmARC.Unbounded_Integers type Calculation_Value is mod System.Max_Binary_Modulus; Digit_Size : constant := Calculation_Value'Size / 2; type Digit_Value is mod 2 ** Digit_Size; package Digit_Lists is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Digit_Value); subtype Digit_List is Digit_Lists.Vector; ... end PragmARC.Unbounded_Integers; package body PragmARC.Unbounded_Integers is ... use type Digit_List; function Element (List : Digit_List; Index : Positive) return Digit_Value; -- If Index is a valid index into List, returns the value stored there; otherwise, returns 0 ... ... List.Element (Index) ... -- Index is known to be a valid index for List ... ... Element (Left.Digit, I) ... I may not be a valid index for Left.Digit Until recently, this was no problem. Calls like the 1st example called the primitive Element declared in Digit_Lists. Calls like the 2nd called the non-primitive Element declared in Unbounded_Integers, the only one directly visible. Recently I've received a couple of reports that this code fails to compile with GNAT GPL 2015. It complains, for calls like List.Element, that it can't resolve Element, pointing to the primitive one in Digit_Lists and the non-primitive one in Unbounded_Integers. I dismissed this as a compiler error, since Object.Operation notation may only be used for primitive operations. However, I've more recently been informed that "gcc 6" on FreeBSD gives the same error. While I still think this is a compiler error, I thought I'd ask the language lawyers and ARG members on here to make sure. Note that Unbounded_Integers is written to ISO/IEC 8652:2007, and so may not compile with an Ada-12 compiler. For GNAT, that means it should be compiled with the -gnat05 option. However, I see no reason why it should not also be valid Ada 12, and it was reported that ggc 6 gives the same error with or without that option. -- Jeff Carter "[M]any were collected near them, ... to enjoy the sight of a dead young lady, nay, two dead young ladies, for it proved twice as fine as the first report." Persuasion 155