// RUN: %check_clang_tidy -std=c++11 %s bugprone-incorrect-enable-if %t // RUN: %check_clang_tidy -check-suffix=CXX20 -std=c++20 %s bugprone-incorrect-enable-if %t // NOLINTBEGIN namespace std { template struct enable_if { }; template struct enable_if { typedef T type; }; template using enable_if_t = typename enable_if::type; } // namespace std // NOLINTEND template ::type> void valid_function1() {} template ::type = nullptr> void valid_function2() {} template ::type = nullptr> struct ValidClass1 {}; template > void invalid() {} // CHECK-MESSAGES: [[@LINE-2]]:23: warning: incorrect std::enable_if usage detected; use 'typename std::enable_if<...>::type' [bugprone-incorrect-enable-if] // CHECK-FIXES: template ::type> // CHECK-FIXES-CXX20: template ::type> template > void invalid_extra_whitespace() {} // CHECK-MESSAGES: [[@LINE-2]]:23: warning: incorrect std::enable_if usage detected; use 'typename std::enable_if<...>::type' [bugprone-incorrect-enable-if] // CHECK-FIXES: template ::type > // CHECK-FIXES-CXX20: template ::type > template > void invalid_extra_no_whitespace() {} // CHECK-MESSAGES: [[@LINE-2]]:23: warning: incorrect std::enable_if usage detected; use 'typename std::enable_if<...>::type' [bugprone-incorrect-enable-if] // CHECK-FIXES: template ::type> // CHECK-FIXES-CXX20: template ::type> template /*comment3*/> void invalid_extra_comment() {} // CHECK-MESSAGES: [[@LINE-2]]:23: warning: incorrect std::enable_if usage detected; use 'typename std::enable_if<...>::type' [bugprone-incorrect-enable-if] // CHECK-FIXES: template ::type/*comment3*/> template , typename = std::enable_if> void invalid_multiple() {} // CHECK-MESSAGES: [[@LINE-2]]:23: warning: incorrect std::enable_if usage detected; use 'typename std::enable_if<...>::type' [bugprone-incorrect-enable-if] // CHECK-MESSAGES: [[@LINE-3]]:65: warning: incorrect std::enable_if usage detected; use 'typename std::enable_if<...>::type' [bugprone-incorrect-enable-if] // CHECK-FIXES: template ::type, typename = typename std::enable_if::type> // CHECK-FIXES-CXX20: template ::type, typename = std::enable_if::type> template > struct InvalidClass {}; // CHECK-MESSAGES: [[@LINE-2]]:23: warning: incorrect std::enable_if usage detected; use 'typename std::enable_if<...>::type' [bugprone-incorrect-enable-if] // CHECK-FIXES: template ::type> // CHECK-FIXES-CXX20: template ::type>