Re: error: static assertion failed: comparison object must be invocable as const

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Martin Gansser wrote on 2020/12/19 21:03:
Hi,

marsshooter-0.7.6 fails on rawhide with this error message [1]:

/builddir/build/BUILD/M.A.R.S.-marsshooter-0.7.6/src/Hud/TabStats.cpp:68:140:   required from here
/usr/include/c++/11/bits/stl_tree.h:785:15: error: static assertion failed: comparison object must be invocable as const
   785 |               is_invocable_v<const _Compare&, const _Key&, const _Key&>,
       |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[1] https://kojipkgs.fedoraproject.org//work/tasks/7520/57787520/build.log

How can i solve this ?

Regards
Martin

Please post the URL for the top task, not for buid log.
https://koji.fedoraproject.org/koji/taskinfo?taskID=57787520

Anyway, it seems to be saying that comparison function of std::map or std::multimap must be
declared with some "constness".

The following patch seems to work:
-----------------------------------------------------------------------
--- M.A.R.S.-marsshooter-0.7.6/include/Hud/TabStats.hpp.debug	2016-01-10 22:40:55.000000000 +0900
+++ M.A.R.S.-marsshooter-0.7.6/include/Hud/TabStats.hpp	2020-12-19 23:06:51.240894165 +0900
@@ -40,13 +40,13 @@ class TabStats: public HudElement {
private:
         struct playerPtrCmp{
-            bool operator()(Player* lhs, Player* rhs){
+            bool operator()(const Player* lhs, const Player* rhs) const {
                 return lhs->points_ > rhs->points_;
             }
         };
struct teamPtrCmp{
-            bool operator()(Team* lhs, Team* rhs){
+            bool operator()(const Team* lhs, const Team* rhs) const {
                 return lhs->points() > rhs->points();
             }
         };

-----------------------------------------------------------------------
Scratch build with the above patch is:
https://koji.fedoraproject.org/koji/taskinfo?taskID=57798127

Regards,
Mamoru
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux