Gecode / gecode

Generic Constraint Development Environment
https://www.gecode.org
Other
275 stars 76 forks source link

Fix 6.3.0 compilation with GCC and -std=c++20 #153

Closed fkonvick closed 2 years ago

fkonvick commented 2 years ago

Hi, I'm getting

gecode/kernel/gpi.hpp:190:50: error: ‘memory_order_seq_cst’ is not a member of ‘std::memory_order’

with the current gecode-6.3.0 and GCC 10.3 in the c++20 mode. This wasn't an issue with Gecode 6.2.0. gpi.hpp uses the following construct:

#if _LIBCPP_STD_VER <= 17
    c->init(npid.fetch_add(1, std::memory_order::memory_order_seq_cst),gid);
#else
    c->init(npid.fetch_add(1, std::memory_order_seq_cst),gid);
#endif

So the condition is apparently incorrect for my environment, but it is also not needed: elsewhere in the code, including gpi.hpp itself, it suffices to take the "#else" approach - std::memory_order_seq_cst compiles fine in both c++17 and c++20 modes.

zayenz commented 2 years ago

This was fixed in a branch that had not been merged in to release/6.3.0 yet. Merged it now (including the fix for memory order), see #140

Thanks for reporting.

fkonvick commented 2 years ago

Thanks, that's cool :)

StefanBruens commented 1 year ago

Can we please have a release which includes these fixes?