comp.lang.ada
 help / color / mirror / Atom feed
From: JLotty <jlotspeich34@gmail.com>
Subject: "Equality operator appears too late"
Date: Sat, 10 Nov 2018 02:36:28 -0800 (PST)
Date: 2018-11-10T02:36:28-08:00	[thread overview]
Message-ID: <33246c2f-a26c-4744-b468-0a7637bc838f@googlegroups.com> (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.


             reply	other threads:[~2018-11-10 10:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-10 10:36 JLotty [this message]
2018-11-10 13:34 ` "Equality operator appears too late" 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
replies disabled

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