[libc++][NFC] Correct comment about P0600 missing node_handle bits

Differential Revision: https://reviews.llvm.org/D109027
This commit is contained in:
Louis Dionne 2021-08-31 17:46:01 -04:00
parent 3557c7c122
commit 9d7ae0acde
3 changed files with 67 additions and 17 deletions

View File

@ -40,7 +40,7 @@ Paper Status
.. note::
.. [#note-P0600] P0600: The missing bits in P0600 are in |sect|\ [mem.res.class], |sect|\ [mem.poly.allocator.class], and |sect|\ [container.node.overview].
.. [#note-P0600] P0600: The missing bits in P0600 are in |sect|\ [mem.res.class] and |sect|\ [mem.poly.allocator.class].
.. [#note-P0966] P0966: It was previously erroneously marked as complete in version 8.0. See `bug 45368 <https://llvm.org/PR45368>`__.
.. [#note-P0619] P0619: Only sections D.8, D.9, D.10 and D.13 are implemented. Sections D.4, D.7, D.11, D.12, and D.14 remain undone.
.. [#note-P0883] P0883: shared_ptr and floating-point changes weren't applied as they themselves aren't implemented yet.

View File

@ -0,0 +1,52 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// Make sure the various node handles mark their .empty() method with
// [[nodiscard]] starting with C++20
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
void test() {
{
std::map<int, int>::node_type node;
node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
{
std::multimap<int, int>::node_type node;
node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
{
std::set<int> node;
node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
{
std::multiset<int> node;
node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
{
std::unordered_map<int, int> node;
node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
{
std::unordered_multimap<int, int> node;
node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
{
std::unordered_set<int> node;
node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
{
std::unordered_multiset<int> node;
node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
}

View File

@ -15,29 +15,27 @@
#include "test_macros.h"
#include "min_allocator.h"
using namespace std;
// [container.node.overview] Table 83.
template <class K, class T, class C1, class C2, class H1, class H2, class E1, class E2, class A_set, class A_map>
struct node_compatibility_table
{
static constexpr bool value =
is_same_v<typename map<K, T, C1, A_map>::node_type, typename map<K, T, C2, A_map>::node_type> &&
is_same_v<typename map<K, T, C1, A_map>::node_type, typename multimap<K, T, C2, A_map>::node_type> &&
is_same_v<typename set<K, C1, A_set>::node_type, typename set<K, C2, A_set>::node_type> &&
is_same_v<typename set<K, C1, A_set>::node_type, typename multiset<K, C2, A_set>::node_type> &&
is_same_v<typename unordered_map<K, T, H1, E1, A_map>::node_type, typename unordered_map<K, T, H2, E2, A_map>::node_type> &&
is_same_v<typename unordered_map<K, T, H1, E1, A_map>::node_type, typename unordered_multimap<K, T, H2, E2, A_map>::node_type> &&
is_same_v<typename unordered_set<K, H1, E1, A_set>::node_type, typename unordered_set<K, H2, E2, A_set>::node_type> &&
is_same_v<typename unordered_set<K, H1, E1, A_set>::node_type, typename unordered_multiset<K, H2, E2, A_set>::node_type>;
std::is_same_v<typename std::map<K, T, C1, A_map>::node_type, typename std::map<K, T, C2, A_map>::node_type> &&
std::is_same_v<typename std::map<K, T, C1, A_map>::node_type, typename std::multimap<K, T, C2, A_map>::node_type> &&
std::is_same_v<typename std::set<K, C1, A_set>::node_type, typename std::set<K, C2, A_set>::node_type> &&
std::is_same_v<typename std::set<K, C1, A_set>::node_type, typename std::multiset<K, C2, A_set>::node_type> &&
std::is_same_v<typename std::unordered_map<K, T, H1, E1, A_map>::node_type, typename std::unordered_map<K, T, H2, E2, A_map>::node_type> &&
std::is_same_v<typename std::unordered_map<K, T, H1, E1, A_map>::node_type, typename std::unordered_multimap<K, T, H2, E2, A_map>::node_type> &&
std::is_same_v<typename std::unordered_set<K, H1, E1, A_set>::node_type, typename std::unordered_set<K, H2, E2, A_set>::node_type> &&
std::is_same_v<typename std::unordered_set<K, H1, E1, A_set>::node_type, typename std::unordered_multiset<K, H2, E2, A_set>::node_type>;
};
template <class T> struct my_hash
{
using argument_type = T;
using result_type = size_t;
using result_type = std::size_t;
my_hash() = default;
size_t operator()(const T&) const {return 0;}
std::size_t operator()(const T&) const {return 0;}
};
template <class T> struct my_compare
@ -66,9 +64,9 @@ namespace std
template <> struct hash<Static>
{
using argument_type = Static;
using result_type = size_t;
using result_type = std::size_t;
hash() = default;
size_t operator()(const Static&) const;
std::size_t operator()(const Static&) const;
};
}
@ -82,8 +80,8 @@ static_assert(node_compatibility_table<
static_assert(
node_compatibility_table<int, int, std::less<int>, my_compare<int>,
std::hash<int>, my_hash<int>, std::equal_to<int>,
my_equal<int>, allocator<int>,
allocator<std::pair<const int, int>>>::value,
my_equal<int>, std::allocator<int>,
std::allocator<std::pair<const int, int>>>::value,
"");
static_assert(node_compatibility_table<