Commit 0b00c490 authored by Edwin Carlinet's avatar Edwin Carlinet
Browse files

Fix GCC-7 compilation after cmcstl2 upgrade (which compiles with stdc++20)

parent fe59cbe5
......@@ -51,11 +51,11 @@ target_sources(Pylene PRIVATE
# Compiler configurations
target_compile_features(Pylene PUBLIC cxx_std_17)
# Add concepts support for gcc > 7.2 with -fconcepts
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.2)
target_compile_options(Pylene PUBLIC -fconcepts)
# Add concepts support for gcc > 8 with -fconcepts
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8)
set(PYLENE_CONCEPT_TS_ENABLED True PARENT_SCOPE)
find_package(cmcstl2 REQUIRED)
target_link_libraries(Pylene PUBLIC stl2)
target_link_libraries(Pylene PUBLIC stl2) # This add appropriate -fconcept flags
target_compile_definitions(Pylene PUBLIC PYLENE_CONCEPT_TS_ENABLED)
endif ()
......
......@@ -83,7 +83,7 @@ namespace mln::ranges
void next() requires (mln::concepts::stl::ForwardRange<Rngs> && ...)
// clang-format on
#else
template <typename U = void, typename = std::enable_if_t<(::ranges::ForwardRange<Rngs>() && ...)>>
template <typename U = void, typename = std::enable_if_t<(::ranges::ForwardRange<Rngs>() && ...), U>>
void next()
#endif
{
......@@ -94,30 +94,13 @@ namespace mln::ranges
// clang-format off
void prev() requires (mln::concepts::stl::BidirectionalRange<Rngs> && ...)
// clang-format on
{
std::apply([](auto&... rng_it) { (--rng_it, ...); }, begins_);
}
#else
// Clunky SFINAE doesn't work
/*
template <typename U = void, typename = std::enable_if_t<(::ranges::BidirectionalRange<Rngs>() && ...)>>
template <class U = void, class = std::enable_if_t<(::ranges::BidirectionalRange<Rngs>() && ...), U>>
void prev()
#endif
{
std::apply([](auto&... rng_it) { (--rng_it, ...); }, begins_);
}
*/
void prev()
{
if constexpr (are_bidir_rngs_)
{
std::apply([](auto&... rng_it) { (--rng_it, ...); }, begins_);
}
else
{
static_assert(are_bidir_rngs_, "Cannot traverse non-bidirectional range backward");
}
}
#endif
};
cursor begin_cursor()
......
......@@ -89,7 +89,7 @@ add_core_test(${test_prefix}mask2d se/mask2d.cpp)
# test Concepts
# Add concepts support for gcc > 7.2 with -fconcepts
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.2)
if (PYLENE_CONCEPT_TS_ENABLED)
add_core_test(${test_prefix}concept_values concept/values.cpp)
add_core_test(${test_prefix}concept_points concept/points.cpp)
add_core_test(${test_prefix}concept_pixels concept/pixels.cpp)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment