comp.lang.ada
 help / color / mirror / Atom feed
From: Marius Amado-Alves <amado.alves@gmail.com>
Subject: Bad cursor, good cursor
Date: Mon, 27 Mar 2017 09:56:32 -0700 (PDT)
Date: 2017-03-27T09:56:32-07:00	[thread overview]
Message-ID: <daa754ff-d2fc-484e-bfe8-e55a2f63ce53@googlegroups.com> (raw)

Ada 2012 compiled with latest(?) free GNAT (20160515-19)

This breaks with a "bad cursor" error for Subthing_Maps.Element at line 7. But how can that be, if the cursor has just been vetted at line 6 as not No_Element, and there were no changes to the container meanwhile, not even navigation?

1   C := Thing.Find (Thing_ID);
2   if C = Thing_Maps.No_Element then
3      Thing.Insert (Thing_ID, Subthing_Maps.Empty_Map, C, Ok);
4   end if;
5   I := Subthing_Maps.Find (Thing_Maps.Element (C), Subthing_ID);
6   if I = Subthing_Maps.No_Element
7   or else Subthing_Maps.Element (I) = Preterred then
8      Thing.Update_Element (C, Add_Subthing'Access);
9   end if;

(Thing is a map of Subthing_Maps. C, I are cursors of these containers, respectively. The keys are Unbounded_String. The maps are Ordered_Maps.)

What might I be missing, language-wise? Or might it be a GNAT bug? Thanks.

             reply	other threads:[~2017-03-27 16:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27 16:56 Marius Amado-Alves [this message]
2017-03-27 18:12 ` Bad cursor, good cursor G.B.
2017-03-27 18:35   ` Marius Amado-Alves
2017-03-27 22:26     ` Randy Brukardt
replies disabled

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