23 lines · cpp
1// RUN: %check_clang_tidy -std=c++20 %s modernize-use-constraints %t -- -- -fno-delayed-template-parsing2 3// NOLINTBEGIN4namespace std {5template <bool B, class T = void> struct enable_if { };6 7template <class T> struct enable_if<true, T> { typedef T type; };8 9template <bool B, class T = void>10using enable_if_t = typename enable_if<B, T>::type;11 12} // namespace std13// NOLINTEND14 15// Separate test file for the case where the first '>>' token part of16// an enable_if expression correctly handles the synthesized token.17 18template <typename T, typename = std::enable_if_t<T::some_value>>19void first_greatergreater_is_enable_if() {20}21// CHECK-MESSAGES: :[[@LINE-3]]:23: warning: use C++20 requires constraints instead of enable_if [modernize-use-constraints]22// CHECK-FIXES: void first_greatergreater_is_enable_if() requires T::some_value {23