Thanks Jeremiah, I was suspecting something like that but I didn't think it was coming from use clause. I was confused by the error message. I'll send a compiler bug report.
Regards, Pascal. http://blady.pagesperso-orange.fr > Le 14 mai 2017 à 16:50, Jeremiah Breeden <jeremiah.bree...@gmail.com> a écrit > : > > Just did a few different tests. Since Element_Type is derived from tagged > type Base_Type, the On_Destroy procedure is inherited and there is an > implicit On_Destory(Object : in out Element_Type) created in > Gnoga.Gui.Elements. When you provide a "use" clause in your main subprogram, > it brings that inherited version into scope. Then you create your > On_Destroy(Object : in out Base_Type'Class) procedure. At this point you > have two On_Destroy procedures in scope. When you try to assign it to the > On_Destroy_Handler procedure, it can't tell which of the two versions of > On_Destroy you want to take the 'Access of. > > I think the error messages could be clearer, but I think that is correct > operation as far as the compiler is concerned. I don't know if it can > resolve the 'Access based on the expected prototype. General user thought > process might expect that the compiler can pick the one that matches the > Action_Event prototype, but I am not a compiler writer, so I am not sure how > easy it is to do that nor do I know what the standard dictates for this. > > On Sun, May 14, 2017 at 10:04 AM, Jeremiah Breeden > <jeremiah.bree...@gmail.com> wrote: > The error seems off to me. What I found was it was your "use > Gnoga.Gui.Element" line. In seems to expose the On_Destroy from > Gnoga.Gui.Base into scope so that your On_Destroy method and the one in > Gnoga.Gui.Base conflict somehow. > > Taking out the use and adding to Gnoga.Gui.Element. to the various calls is > an alternate way of fixing it. > > I'm not sure why the two procedures conflict. They have different > signatures, and the conflicting procedure isn't even in the package that is > "use"ed > > This might be a question for comp.lang.ada. If I get time later, I'll try > and parse through the RM to see if this is a bug or not, but it does seem > odd. Maybe inherited functions of tagged types get exposed to the package > that extends those types. If so, that is why On_Destroy would conflict in > your call. Going only by the name of the procedure with not context, it > happens to chose the one from Gnoga.Gui.Base, which doesn't match the > Action_Event prototype. > > On Sun, May 14, 2017 at 4:33 AM, Pascal <blady-...@users.sf.net> wrote: > Hello, > > I've added a destroy handler to multiuser.adb test program: > > > > But I've got the following error with GNAT GPL 2016: > > gprbuild -ws -c -f -u -P/gnoga-code/test/test.gpr > -XLIB_COMPONENTS_BUILD=default -XPRJ_TARGET=OSX -XPRJ_BUILD=Debug > multiuser.adb > gcc -c -gnaty3abcefhiklM120nOprsStu -gnat2012 -gnatW8 -g -gnata -gnatq -gnatQ > -gnatw.eH.YD -gnatVa -gnato -fstack-check -gnatf -gnateE -gnateF > -gnatec=/gnoga-code/pragma_debug.adc -fno-common multiuser.adb > multiuser.adb:64:07: warning: "App" is not modified, could be declared > constant > multiuser.adb:81:07: warning: "App" is not modified, could be declared > constant > multiuser.adb:94:07: warning: "App" is not modified, could be declared > constant > multiuser.adb:103:07: warning: "App" is not modified, could be declared > constant > multiuser.adb:109:07: warning: variable "App" is not referenced > multiuser.adb:119:07: warning: "App" is not modified, could be declared > constant > multiuser.adb:193:43: no candidate interpretations match the actuals: > multiuser.adb:193:43: missing argument for parameter "Object" in call to > "On_Destroy" declared at line 115 > multiuser.adb:193:43: missing argument for parameter "Object" in call to > "On_Destroy" (inherited) at gnoga-gui-element.ads:51 > multiuser.adb:193:43: context requires function call, found procedure name > multiuser.adb:193:53: ==> in call to inherited operation > "On_Destroy_Handler" at gnoga-gui-window.ads:56 > multiuser.adb:218:07: warning: "D" modified by call, but value never > referenced > gprbuild: *** compilation phase failed > [2017-05-14 10:21:43] process exited with status 4, elapsed time: 00.69s > > If I change ligne 193 to: > > App.Main_Window.On_Destroy_Handler > (Multiuser.On_Destroy'Unrestricted_Access); > > No more errors. > > Why these errors not so much clear are issued? > Why local procedure On_Destroy isn't visible? > > Thanks, Pascal. > http://blady.pagesperso-orange.fr > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Gnoga-list mailing list Gnoga-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gnoga-list