Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: Robert Eastwood on June 28, 2019, 04:47:45 am

Title: If your building with -std=c++17 a line change is needed
Post by: Robert Eastwood on June 28, 2019, 04:47:45 am
-std=c++1z has strict enforcement of const in comparison, as explained here
(it wont build without fixing this using -std=c++1z mingw64 8.1, codeblocks 17.12 recent trunk)

https://stackoverflow.com/questions/51235355/comparison-object-being-invocable-as-const

so you don't have to find how to correct the problem if your building with -std=c++1z, presuming your mingw64 has the same compile time assert
Code
openfileslistplugin.h
line 26
bool operator()(const ProjectFile* lhs, const ProjectFile* rhs) { return lhs->editorTabPos < rhs->editorTabPos; }
should be
bool operator()(const ProjectFile* lhs, const ProjectFile* rhs) const { return lhs->editorTabPos < rhs->editorTabPos; }

basically all compare functions used by containers now need proper const syntax.  while using mingw64 8.1

and an interesting answer, or I found it interesting, on the -std=c++17 and -std=c++1z naming(I thought it was always being stylish).
https://meta.stackoverflow.com/questions/352031/why-is-the-c17-tag-replaced-by-the-c1z-tag