15a83710eSEric Fiselier //===----------------------------------------------------------------------===// 25a83710eSEric Fiselier // 357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 65a83710eSEric Fiselier // 75a83710eSEric Fiselier //===----------------------------------------------------------------------===// 85a83710eSEric Fiselier 9*dc066888SArthur O'Dwyer // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS 10*dc066888SArthur O'Dwyer 115a83710eSEric Fiselier // <functional> 125a83710eSEric Fiselier 135a83710eSEric Fiselier // logical_not 145a83710eSEric Fiselier 155a83710eSEric Fiselier #include <functional> 165a83710eSEric Fiselier #include <type_traits> 175a83710eSEric Fiselier #include <cassert> 185a83710eSEric Fiselier 190f901c7eSStephan T. Lavavej #include "test_macros.h" 200f901c7eSStephan T. Lavavej main(int,char **)212df59c50SJF Bastienint main(int, char**) 225a83710eSEric Fiselier { 235a83710eSEric Fiselier typedef std::logical_not<int> F; 245a83710eSEric Fiselier const F f = F(); 25*dc066888SArthur O'Dwyer #if TEST_STD_VER <= 17 26601fa8d8SMarshall Clow static_assert((std::is_same<F::argument_type, int>::value), "" ); 27601fa8d8SMarshall Clow static_assert((std::is_same<F::result_type, bool>::value), "" ); 28*dc066888SArthur O'Dwyer #endif 295a83710eSEric Fiselier assert(!f(36)); 305a83710eSEric Fiselier assert(f(0)); 310f901c7eSStephan T. Lavavej #if TEST_STD_VER > 11 325a83710eSEric Fiselier typedef std::logical_not<> F2; 335a83710eSEric Fiselier const F2 f2 = F2(); 345a83710eSEric Fiselier assert(!f2(36)); 355a83710eSEric Fiselier assert( f2(0)); 365a83710eSEric Fiselier assert(!f2(36L)); 375a83710eSEric Fiselier assert( f2(0L)); 385a83710eSEric Fiselier 395a83710eSEric Fiselier constexpr bool foo = std::logical_not<int> () (36); 405a83710eSEric Fiselier static_assert ( !foo, "" ); 415a83710eSEric Fiselier 425a83710eSEric Fiselier constexpr bool bar = std::logical_not<> () (36); 435a83710eSEric Fiselier static_assert ( !bar, "" ); 445a83710eSEric Fiselier #endif 452df59c50SJF Bastien 462df59c50SJF Bastien return 0; 475a83710eSEric Fiselier } 48