comp.lang.ada
 help / color / mirror / Atom feed
* "Equality operator appears too late"
@ 2018-11-10 10:36 JLotty
  2018-11-10 13:34 ` joakimds
  2019-03-12 11:47 ` Simon Wright
  0 siblings, 2 replies; 6+ messages in thread
From: JLotty @ 2018-11-10 10:36 UTC (permalink / raw)


with Ada.Containers.Synchronized_Queue_Interfaces;
with Ada.Containers.Unbounded_Priority_Queues;
procedure Min_Working_Example is

   generic
      type Data_Type is private;
      type Weight_Type is (<>);
      with function "<" (Left, Right : Weight_Type) return Boolean is <>;
   package Min_Data_Structure is
   private
      type Data_Rec is record
         Data   : Data_Type;
         Weight : Weight_Type;
      end record;
      
      function Get_Priority
        (Element : Data_Rec)
      return Weight_Type;

      function Before
        (Left, Right : Weight_Type)
      return Boolean;

      package Queue_Interface is new Ada.Containers.Synchronized_Queue_Interfaces
        (Data_Rec);

      package Edge_Queue is new Ada.Containers.Unbounded_Priority_Queues
        (Queue_Interfaces => Queue_Interface,
         Queue_Priority   => Weight_Type,
         Get_Priority     => Get_Priority,
         Before           => Before);
   end Min_Data_Structure;
   
   package body Min_Data_Structure is
      function Get_Priority
        (Element : Data_Rec)
         return Weight_Type is
        (Element.Weight);

      function Before
        (Left, Right : Weight_Type)
         return Boolean is
        (Left < Right);
   end Min_Data_Structure;
begin
   null;
end Min_Working_Example;

==================================================
When compiling the above, I get the following error:
Builder results
    min_working_example.adb
        27:7 equality operator appears too late
        27:7 instantiation error at a-cuprqu.ads:76

The error is occurring when the builder tries to elaborate the Ada.Containers.Unbounded_Priority_Queues package, where and "=" operator is defined on line 76.

I'm running the following command for build:
gprbuild -q -c -f -gnatc -u -Ptest.gpr min_working_example.adb

using version:
GPRBUILD GPL 2017 (20170515) (x86_64-pc-linux-gnu)
Copyright (C) 2004-2017, AdaCore

I don't know what to do from here.  Any help you can offer would be appreciated.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-03-12 11:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-10 10:36 "Equality operator appears too late" JLotty
2018-11-10 13:34 ` joakimds
2018-11-10 14:36   ` JLotty
2018-11-11  6:32   ` Randy Brukardt
2018-11-11 20:05     ` Simon Wright
2019-03-12 11:47 ` Simon Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox