// Copyright (C) 2015-2019 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 3, or (at your option) // any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // . #include #include #include #include #include #include #include #if defined(test_std_is_swappable) # ifndef __cpp_lib_is_swappable # error "Feature-test macro for is_swappable missing" # elif __cpp_lib_is_swappable != 201603 # error "Feature-test macro for is_swappable has wrong value" # endif // Test std::is_swappable: template using is_swappable = std::is_swappable; #elif defined(test_std_is_swappable_ext) // Test our __is_swappable extension: template using is_swappable = std::__is_swappable; #else # error "Either test_std_is_swappable or test_std_is_swappable_ext" \ "need to be defined" #endif namespace funny { struct F {}; void swap(F&, F&) = delete; void swap(F(&)[5], F(&)[5]); struct F2 { friend void swap(F2&, F2&) = delete; }; struct F3 { friend void swap(F3&, F3) {} }; } void test01() { using namespace __gnu_test; // Positive tests. static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property(true), ""); static_assert(test_property>(true), ""); static_assert(test_property[1]>(true), ""); static_assert(test_property[1][2]>(true), ""); static_assert(test_property[1][2][3]>(true), ""); static_assert(test_property>(true), ""); static_assert(test_property>(true), ""); static_assert(test_property[1]>(true), ""); static_assert(test_property[1][2]>(true), ""); static_assert(test_property[1][2][3]>(true), ""); static_assert(test_property>(true), ""); static_assert(test_property[1]>(true), ""); static_assert(test_property[1][2]>(true), ""); static_assert(test_property[1][2][3]>(true), ""); static_assert(test_property>(true), ""); static_assert(test_property>(true), ""); static_assert(test_property[1]>(true), ""); static_assert(test_property[1][2]>(true), ""); static_assert(test_property[1][2][3]>(true), ""); static_assert(test_property>(true), ""); static_assert(test_property>(true), ""); static_assert(test_property>(true), ""); static_assert(test_property>(true), ""); static_assert(test_property[1]>(true), ""); static_assert(test_property[1][2]>(true), ""); static_assert(test_property[1][2][3]>(true), ""); static_assert(test_property>(true), ""); static_assert(test_property>(true), ""); static_assert(test_property[1]>(true), ""); static_assert(test_property[1][2]>(true), ""); static_assert(test_property[1][2][3]>(true), ""); static_assert(test_property>(true), ""); static_assert(test_property>(true), ""); static_assert(test_property[1]>(true), ""); static_assert(test_property[1][2]>(true), ""); static_assert(test_property[1][2][3]>(true), ""); static_assert(test_property>(true), ""); // Negative tests. static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); static_assert(test_property(false), ""); }