From 18411e5a853a34870a6d30d4bdabb84301ad99c1 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 18 Apr 2023 12:30:43 -0700 Subject: [PATCH] Allow `MapLike` again, and test it. --- stl/inc/map | 4 ---- stl/inc/unordered_map | 4 ---- .../test.compile.pass.cpp | 16 ++++++++++++++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/stl/inc/map b/stl/inc/map index eaca60e293..b7e1cb601c 100644 --- a/stl/inc/map +++ b/stl/inc/map @@ -77,8 +77,6 @@ public: _MISMATCHED_ALLOCATOR_MESSAGE("map", "pair")); static_assert(is_object_v<_Kty>, "The C++ Standard forbids containers of non-object types " "because of [container.requirements]."); - static_assert(is_object_v<_Ty>, "The C++ Standard forbids containers of non-object types " - "because of [container.requirements]."); using _Mybase = _Tree<_Tmap_traits<_Kty, _Ty, _Pr, _Alloc, false>>; using _Nodeptr = typename _Mybase::_Nodeptr; @@ -463,8 +461,6 @@ public: _MISMATCHED_ALLOCATOR_MESSAGE("multimap", "pair")); static_assert(is_object_v<_Kty>, "The C++ Standard forbids containers of non-object types " "because of [container.requirements]."); - static_assert(is_object_v<_Ty>, "The C++ Standard forbids containers of non-object types " - "because of [container.requirements]."); using _Mybase = _Tree<_Tmap_traits<_Kty, _Ty, _Pr, _Alloc, true>>; using key_type = _Kty; diff --git a/stl/inc/unordered_map b/stl/inc/unordered_map index 40561f6eb7..dee66749bf 100644 --- a/stl/inc/unordered_map +++ b/stl/inc/unordered_map @@ -71,8 +71,6 @@ public: _MISMATCHED_ALLOCATOR_MESSAGE("unordered_map", "pair")); static_assert(is_object_v<_Kty>, "The C++ Standard forbids containers of non-object types " "because of [container.requirements]."); - static_assert(is_object_v<_Ty>, "The C++ Standard forbids containers of non-object types " - "because of [container.requirements]."); private: using _Mytraits = _Uhash_compare<_Kty, _Hasher, _Keyeq>; @@ -563,8 +561,6 @@ public: "unordered_multimap", "pair")); static_assert(is_object_v<_Kty>, "The C++ Standard forbids containers of non-object types " "because of [container.requirements]."); - static_assert(is_object_v<_Ty>, "The C++ Standard forbids containers of non-object types " - "because of [container.requirements]."); private: using _Mytraits = _Uhash_compare<_Kty, _Hasher, _Keyeq>; diff --git a/tests/std/tests/Dev11_0437519_container_requirements/test.compile.pass.cpp b/tests/std/tests/Dev11_0437519_container_requirements/test.compile.pass.cpp index 466a658ba6..296ca936c4 100644 --- a/tests/std/tests/Dev11_0437519_container_requirements/test.compile.pass.cpp +++ b/tests/std/tests/Dev11_0437519_container_requirements/test.compile.pass.cpp @@ -3048,6 +3048,17 @@ void assert_container() { check_all_specific_requirements(); } +// MapLike is squirrelly, but appears to be permitted. +template