]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/language.support/support.types/ptrdiff_t.pass.cpp
Vendor import of libc++ trunk r351319 (just before the release_80
[FreeBSD/FreeBSD.git] / test / std / language.support / support.types / ptrdiff_t.pass.cpp
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include <cstddef>
11 #include <type_traits>
12
13 // ptrdiff_t should:
14
15 //  1. be in namespace std.
16 //  2. be the same sizeof as void*.
17 //  3. be a signed integral.
18
19 int main()
20 {
21     static_assert(sizeof(std::ptrdiff_t) == sizeof(void*),
22                   "sizeof(std::ptrdiff_t) == sizeof(void*)");
23     static_assert(std::is_signed<std::ptrdiff_t>::value,
24                   "std::is_signed<std::ptrdiff_t>::value");
25     static_assert(std::is_integral<std::ptrdiff_t>::value,
26                   "std::is_integral<std::ptrdiff_t>::value");
27 }