// { dg-do compile { target c++17 } } // Copyright (C) 2016-2025 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 void test01() { using std::has_unique_object_representations; using __gnu_test::test_category; // Positive tests. static_assert(test_category(true), ""); static_assert(test_category(true), ""); static_assert(test_category(true), ""); static_assert(test_category(true), ""); static_assert(test_category(true), ""); enum E : unsigned { }; static_assert(test_category(true), ""); static_assert(test_category(true), ""); static_assert(test_category(true), ""); static_assert(test_category(true), ""); static_assert(test_category(true), ""); static_assert(test_category(true), ""); static_assert(test_category(true), ""); static_assert(test_category(true), ""); static_assert(test_category(true), ""); struct Padded { char c1; alignas(4) char c2; }; struct Bitfield { int i : 3; }; struct Aligned { alignas(4) char c; }; // Negative tests. static_assert(test_category(false), ""); static_assert(test_category(false), ""); // implementation-defined static_assert(test_category(false), ""); static_assert(test_category(false), ""); static_assert(test_category(false), ""); static_assert(test_category(false), ""); static_assert(test_category(false), ""); static_assert(test_category(false), ""); static_assert(test_category(false), ""); static_assert(test_category(false), ""); static_assert(test_category(false), ""); static_assert(test_category(false), ""); static_assert(test_category(false), ""); static_assert(test_category(false), ""); static_assert(test_category(false), ""); static_assert(test_category(false), ""); static_assert(test_category(false), ""); } void test02() { using std::has_unique_object_representations; using std::has_unique_object_representations_v; static_assert(has_unique_object_representations_v == has_unique_object_representations::value); static_assert(has_unique_object_representations_v == has_unique_object_representations::value); static_assert(has_unique_object_representations_v == has_unique_object_representations::value); }