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 #include <cstddef>
10 #include <type_traits>
11 #include "test_macros.h"
12
13 // XFAIL: c++03, c++11, c++14
14
15 // std::byte is not an integer type, nor a character type.
16 // It is a distinct type for accessing the bits that ultimately make up object storage.
17
18 #if TEST_STD_VER > 17
19 static_assert( std::is_trivial<std::byte>::value, "" ); // P0767
20 #else
21 static_assert( std::is_pod<std::byte>::value, "" );
22 #endif
23 static_assert(!std::is_arithmetic<std::byte>::value, "" );
24 static_assert(!std::is_integral<std::byte>::value, "" );
25
26 static_assert(!std::is_same<std::byte, char>::value, "" );
27 static_assert(!std::is_same<std::byte, signed char>::value, "" );
28 static_assert(!std::is_same<std::byte, unsigned char>::value, "" );
29
30 // The standard doesn't outright say this, but it's pretty clear that it has to be true.
31 static_assert(sizeof(std::byte) == 1, "" );
32
main(int,char **)33 int main(int, char**) {
34 return 0;
35 }
36