File tree Expand file tree Collapse file tree 2 files changed +72
-0
lines changed
libcxx/language.support/support.types
std/language.support/support.types Expand file tree Collapse file tree 2 files changed +72
-0
lines changed Original file line number Diff line number Diff line change 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+ // Make sure libc++'s <cstddef> defines types like ::nullptr_t in the global namespace.
10+ // This is a conforming extension to be consistent with other implementations, which all
11+ // appear to provide that behavior too.
12+
13+ #include < cstddef>
14+ #include " test_macros.h"
15+
16+ using PtrdiffT = ::ptrdiff_t ;
17+ using SizeT = ::size_t ;
18+ #if TEST_STD_VER >= 11
19+ using MaxAlignT = ::max_align_t ;
20+ #endif
21+
22+ // Supported in C++03 mode too for backwards compatibility with previous versions of libc++
23+ using NullptrT = ::nullptr_t ;
24+
25+ // Also ensure that we provide std::nullptr_t in C++03 mode, which is an extension too.
26+ using StdNullptrT = std::nullptr_t ;
Original file line number Diff line number Diff line change 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+ // test the contents of <cstddef>
10+
11+ // namespace std {
12+ // using ptrdiff_t = see below;
13+ // using size_t = see below;
14+ // using max_align_t = see below;
15+ // using nullptr_t = decltype(nullptr);
16+ //
17+ // enum class byte : unsigned char {};
18+ //
19+ // // [support.types.byteops], byte type operations
20+ // [...] other byte-related functionality is tested elsewhere
21+ // }
22+ //
23+ // #define NULL see below
24+ // #define offsetof(P, D) see below
25+
26+ #include < cstddef>
27+ #include " test_macros.h"
28+
29+ using PtrdiffT = std::ptrdiff_t ;
30+ using SizeT = std::size_t ;
31+ #if TEST_STD_VER >= 11
32+ using MaxAlignT = std::max_align_t ;
33+ using NullptrT = std::nullptr_t ;
34+ #endif
35+
36+ #if TEST_STD_VER >= 17
37+ using Byte = std::byte;
38+ #endif
39+
40+ #ifndef NULL
41+ # error "NULL should be defined by <cstddef>"
42+ #endif
43+
44+ #ifndef offsetof
45+ # error "offsetof() should be defined by <cstddef>"
46+ #endif
You can’t perform that action at this time.
0 commit comments