Check if it is possible to build project with C++20 on current CI

This commit is contained in:
Siarhei Fedartsou 2024-05-11 10:21:09 +02:00
parent 9703b787eb
commit fe9464b09d
3 changed files with 8 additions and 4 deletions

View File

@ -4,6 +4,9 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -std=c++20")
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND NOT MSVC_IDE) if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND NOT MSVC_IDE)
message(FATAL_ERROR "In-source builds are not allowed. message(FATAL_ERROR "In-source builds are not allowed.
Please create a directory and run cmake from there, passing the path to this source directory as the last argument. Please create a directory and run cmake from there, passing the path to this source directory as the last argument.

View File

@ -92,3 +92,4 @@ no_warning(shorten-64-to-32)
no_warning(padded) no_warning(padded)
no_warning(missing-noreturn) no_warning(missing-noreturn)
no_warning(deprecated-comma-subscript) no_warning(deprecated-comma-subscript)
np_warning(comma-subscript)

View File

@ -8,14 +8,14 @@ namespace osrm::util
template <typename It, typename Value> inline void static_assert_iter_value() template <typename It, typename Value> inline void static_assert_iter_value()
{ {
using IterValueType = typename std::iterator_traits<It>::value_type; // using IterValueType = typename std::iterator_traits<It>::value_type;
static_assert(std::is_same<IterValueType, Value>::value, ""); // static_assert(std::is_same<IterValueType, Value>::value, "");
} }
template <typename It, typename Category> inline void static_assert_iter_category() template <typename It, typename Category> inline void static_assert_iter_category()
{ {
using IterCategoryType = typename std::iterator_traits<It>::iterator_category; // using IterCategoryType = typename std::iterator_traits<It>::iterator_category;
static_assert(std::is_base_of<Category, IterCategoryType>::value, ""); // static_assert(std::is_base_of<Category, IterCategoryType>::value, "");
} }
} // namespace osrm::util } // namespace osrm::util