Skip to content

Commit

Permalink
More fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mordante committed May 1, 2024
1 parent 4a0bb32 commit 9dfaf1a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
7 changes: 4 additions & 3 deletions libcxx/modules/std/ranges.inc
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@ export namespace std {
}
#endif // _LIBCPP_HAS_NO_LOCALIZATION

#if _LIBCPP_STD_VER >= 23
// [range.adaptor.object], range adaptor objects
using std::ranges::range_adaptor_closure;
// Note: This declaration not in the synopsis or explicitly in the wording.
// However it is needed for the range adaptors.
// [range.adaptor.object]/3
Expand All @@ -151,7 +148,11 @@ export namespace std {
// involving an object of type cv D as an operand to the | operator is
// undefined if overload resolution selects a program-defined operator|
// function.
// This is used internally in C++20 mode.
using std::ranges::operator|;
#if _LIBCPP_STD_VER >= 23
// [range.adaptor.object], range adaptor objects
using std::ranges::range_adaptor_closure;
#endif

// [range.all], all view
Expand Down
19 changes: 19 additions & 0 deletions libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,25 @@ if(NOT HAS_CLANG_TIDY_HEADERS)
"clang-tidy headers are not present.")
return()
endif()

# The clangTidy plugin uses C++20, when using stdlibc++ verify the version is correct.
# Note it has not been tested whether version 11 works.
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test.cpp" "
#if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE < 12
# error The stdlibc++ version is too old.
#endif
int main(){}
")
try_compile(HAS_NEWER_STANDARD_LIBRARY
"${CMAKE_CURRENT_BINARY_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}/test.cpp"
LINK_LIBRARIES clangTidy)

if(NOT HAS_NEWER_STANDARD_LIBRARY)
message(STATUS "Clang-tidy tests are disabled due to using "
"stdlibc++ older than version 12")
return()
endif()
message(STATUS "Clang-tidy tests are enabled.")

set(SOURCES
Expand Down

0 comments on commit 9dfaf1a

Please sign in to comment.