forked from microsoft/STL
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…soft#2726) Co-authored-by: Casey Carter <[email protected]> Co-authored-by: Stephan T. Lavavej <[email protected]>
- Loading branch information
Showing
5 changed files
with
83 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
RUNALL_INCLUDE ..\usual_matrix.lst |
64 changes: 64 additions & 0 deletions
64
tests/std/tests/GH_000527_remove_allocator_void/test.compile.pass.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#define _SILENCE_CXX20_IS_ALWAYS_EQUAL_DEPRECATION_WARNING | ||
|
||
#include <memory> | ||
#include <type_traits> | ||
#include <utility> | ||
|
||
#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) | ||
|
||
using namespace std; | ||
|
||
template <class T, class = void> | ||
constexpr bool has_member_size_type = false; | ||
|
||
template <class T> | ||
constexpr bool has_member_size_type<T, void_t<typename T::size_type>> = true; | ||
|
||
template <class T, class = void> | ||
constexpr bool has_member_difference_type = false; | ||
|
||
template <class T> | ||
constexpr bool has_member_difference_type<T, void_t<typename T::difference_type>> = true; | ||
|
||
template <class T, class = void> | ||
constexpr bool has_member_pocma = false; | ||
|
||
template <class T> | ||
constexpr bool has_member_pocma<T, void_t<typename T::propagate_on_container_move_assignment>> = true; | ||
|
||
template <class T, class = void> | ||
constexpr bool has_member_is_always_equal = false; | ||
|
||
template <class T> | ||
constexpr bool has_member_is_always_equal<T, void_t<typename T::is_always_equal>> = true; | ||
|
||
template <class T, class = void> | ||
constexpr bool can_allocate = false; | ||
|
||
template <class T> | ||
constexpr bool can_allocate<T, void_t<decltype(declval<T&>().allocate(size_t{}))>> = true; | ||
|
||
STATIC_ASSERT(has_member_size_type<allocator<int>>); | ||
STATIC_ASSERT(has_member_difference_type<allocator<int>>); | ||
STATIC_ASSERT(has_member_pocma<allocator<int>>); | ||
STATIC_ASSERT(has_member_is_always_equal<allocator<int>>); | ||
STATIC_ASSERT(can_allocate<allocator<int>>); | ||
STATIC_ASSERT(is_convertible_v<allocator<void>, allocator<int>>); | ||
|
||
#if _HAS_CXX20 | ||
constexpr bool has_cxx20 = true; | ||
#else | ||
constexpr bool has_cxx20 = false; | ||
#endif | ||
|
||
STATIC_ASSERT(has_cxx20 == has_member_size_type<allocator<void>>); | ||
STATIC_ASSERT(has_cxx20 == has_member_difference_type<allocator<void>>); | ||
STATIC_ASSERT(has_cxx20 == has_member_pocma<allocator<void>>); | ||
STATIC_ASSERT(has_cxx20 == has_member_is_always_equal<allocator<void>>); | ||
STATIC_ASSERT(has_cxx20 == can_allocate<allocator<void>>); | ||
STATIC_ASSERT(has_cxx20 == is_convertible_v<allocator<int>, allocator<void>>); | ||
|
||
int main() {} // COMPILE-ONLY |