https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118274

            Bug ID: 118274
           Summary: expression function fails when normal equivalent ones
                    don't.
           Product: gcc
           Version: 14.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 00120260a at gmail dot com
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

This is not normal:
> q09.ada:19:61: error: there is no applicable operator "*" for type "Rates" 
> defined at line 3

procedure Main is
  type Money is delta 0.01 digits 12;
  type Rates is delta 0.00000001 digits 11;
  Conversion: constant array(1..2, 1..2) of Rates := ((1.0, 0.5059), (1.9767,
1.0));
  Special: constant Rates := 1.1;
  Extra: Boolean := True;
  function "*"(Left, Right: Rates) return Rates is
  begin
    if Extra then
      return Standard."*"(Left, Right+0.01);
    else 
      return Standard."*"(Left, Right);
    end if;
  end "*";
  function "-"(Left, Right: Rates) return Rates is
  begin
      return Standard."*"(Left, Right+(if Extra then 0.01 else 0.0));
  end "-";
  function "+"(Left, Right: Rates) return Rates is (Standard."*"(Left,
Right+(if Extra then 0.01 else 0.0))); -- FAILS
begin
 null;
end Main;

Reply via email to