This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Ada] Checks on intrinsic operators



On 13 Oct 2011, at 11:22, Arnaud Charlet wrote:


An operator can be declared Import (Intrinsic) only if the current view of the
operand type (s) is a numeric type. With this patch the compiler properly
rejects the pragma if the operand type is private or incomplete.


Compiling mysystem.ads must yield:

mysystem.ads:3:13: intrinsic operator can only apply to numeric types
mysystem.ads:7:13: intrinsic operator can only apply to numeric types
mysystem.ads:7:18: invalid use of incomplete type "Self"


---
package Mysystem is
  type A is private;
  function "<"  (Left, Right : A) return Boolean;
  pragma Import (Intrinsic, "<");

  type Self;
  function "+" (X, Y : Self) return Boolean;
  pragma Import (Intrinsic, "+");
  type Self is tagged null record;
private
  type A is mod 2 ** 32;
end Mysystem;

just out of curiosity, is there a reason why some of the changes applied say " x must do y " with an example - but the example is not made into a test-case?
(apologies if this has already be discussed).
Iain



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]