greatspn / SOURCES

Main repository of the GreatSPN framework
GNU General Public License v2.0
42 stars 13 forks source link

[OSX 10.11.6] Compile fails in WN/SOURCE/SHARED/mainMEDD2.cpp:12 #3

Closed arkanoid87 closed 3 years ago

arkanoid87 commented 6 years ago

[YACC] WN/TRANSL/wn_grammar.y [CC] objects/RGMEDD2/WN/TRANSL/wn_grammar.y.c [LEX] WN/TRANSL/wn.l [CC] objects/RGMEDD2/WN/TRANSL/wn.l.c [C++] WN/SOURCE/SHARED/mainMEDD2.cpp In file included from WN/SOURCE/SHARED/mainMEDD2.cpp:12: WN/SOURCE/SHARED/../RGMEDD2/rgmedd2.h:563:18: error: no matching member function for call to 'evaluate' fEV->evaluate((*indexrs), plmark, idm);


/usr/local/include/meddly.h:1865:18: note: candidate function not viable: no known conversion from
      'int' to 'bool &' for 3rd argument
    virtual void evaluate(const dd_edge &f, const int* vlist, bool &term)
                 ^
/usr/local/include/meddly.h:1879:18: note: candidate function not viable: no known conversion from
      'int' to 'long &' for 3rd argument
    virtual void evaluate(const dd_edge &f, const int* vlist, long &term)
                 ^
/usr/local/include/meddly.h:1893:18: note: candidate function not viable: no known conversion from
      'int' to 'float &' for 3rd argument
    virtual void evaluate(const dd_edge &f, const int* vlist, float &term)
                 ^
/usr/local/include/meddly.h:1912:18: note: candidate function not viable: requires 4 arguments, but 3
      were provided
    virtual void evaluate(const dd_edge& f, const int* vlist,
                 ^
/usr/local/include/meddly.h:1931:18: note: candidate function not viable: requires 4 arguments, but 3
      were provided
    virtual void evaluate(const dd_edge& f, const int* vlist,
                 ^
/usr/local/include/meddly.h:1950:18: note: candidate function not viable: requires 4 arguments, but 3
      were provided
    virtual void evaluate(const dd_edge& f, const int* vlist,
                 ^
1 error generated.
make: *** [objects/RGMEDD2/WN/SOURCE/SHARED/mainMEDD2.o] Error 1
➜  SOURCES git:(master)

fEV->evaluate, but I can't find the evaluate function declared for the forest object

EDIT:
changing int &idm to long &idm fixed the compilation issue, but I can't forecast the consequences (using Maddy master)

EDIT2:
I confirm that the editor runs on OSX after the change
yanntm commented 5 years ago

(sorry edited answer, bad patch) This issue is better solved in meddly itself probably. See this solution for instance : https://github.com/yanntm/SOURCES/commit/05ca770e978bc259967043ba43d297b162400891

The problem is there are two conversions to fit to the declarations available, one of which loses precision. And it's across references so building temporaries is not possible.

GallaFrancesco commented 5 years ago

This was caused by a change in the Meddly library which modified the declaration of evaluate to MEDDLY::forest::evaluate(const dd_edge &f, const int* vl, long &t). The argument t which is causing the compilation error has been converted to long in the function prototype (see Meddly/src/forest.cc:415).

I've committed a fix changing int &idm to long &idm, which shouldn't have noticeable consequences. Thank you!

Edit: Since the solution adopted seems to cause issue on different platforms (notably the GreatSPN VM) I've adopted a template-based approach to let the compiler optimize out the different precisions and binding temporaries to a ref lvalue is not an issue anymore.