1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS 10 11 // <functional> 12 13 // logical_not 14 15 #include <functional> 16 #include <type_traits> 17 #include <cassert> 18 19 #include "test_macros.h" 20 main(int,char **)21int main(int, char**) 22 { 23 typedef std::logical_not<int> F; 24 const F f = F(); 25 #if TEST_STD_VER <= 17 26 static_assert((std::is_same<F::argument_type, int>::value), "" ); 27 static_assert((std::is_same<F::result_type, bool>::value), "" ); 28 #endif 29 assert(!f(36)); 30 assert(f(0)); 31 #if TEST_STD_VER > 11 32 typedef std::logical_not<> F2; 33 const F2 f2 = F2(); 34 assert(!f2(36)); 35 assert( f2(0)); 36 assert(!f2(36L)); 37 assert( f2(0L)); 38 39 constexpr bool foo = std::logical_not<int> () (36); 40 static_assert ( !foo, "" ); 41 42 constexpr bool bar = std::logical_not<> () (36); 43 static_assert ( !bar, "" ); 44 #endif 45 46 return 0; 47 } 48