Skip to content

Commit

Permalink
Revert "replaces TODOs"
Browse files Browse the repository at this point in the history
This reverts commit bb82c95.
  • Loading branch information
cjdb committed Sep 8, 2024
1 parent bb82c95 commit 33a452d
Show file tree
Hide file tree
Showing 7 changed files with 1,519 additions and 40 deletions.
1,459 changes: 1,459 additions & 0 deletions diags.patch

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions libcxx/include/map
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,8 @@ public:

template <class _Key, class _Tp, class _Compare = less<_Key>, class _Allocator = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_TEMPLATE_VIS map {
// TODO(#106635): replace with _LIBCPP_CHECK_CONTAINER_VALUE_TYPE_REQUIREMENTS
// Remember to remove relevant headers when this is completed.
static_assert(!is_lvalue_reference<_Key>::value, "'std::map' cannot hold references");
static_assert(!is_function<_Key>::value && !is_function<_Tp>::value, "'std::map' cannot hold functions");
static_assert(!is_void<_Key>::value && !is_void<_Tp>::value, "'std::map' cannot hold 'void'");
Expand Down Expand Up @@ -1649,6 +1651,8 @@ erase_if(map<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred) {

template <class _Key, class _Tp, class _Compare = less<_Key>, class _Allocator = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_TEMPLATE_VIS multimap {
// TODO(#106635): replace with _LIBCPP_CHECK_CONTAINER_VALUE_TYPE_REQUIREMENTS
// Remember to remove relevant headers when this is completed.
static_assert(!is_lvalue_reference<_Key>::value, "'std::multimap' cannot hold references");
static_assert(!is_function<_Key>::value && !is_function<_Tp>::value, "'std::multimap' cannot hold functions");
static_assert(!is_void<_Key>::value && !is_void<_Tp>::value, "'std::multimap' cannot hold 'void'");
Expand Down
4 changes: 4 additions & 0 deletions libcxx/include/unordered_map
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,8 @@ template <class _Key,
class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_TEMPLATE_VIS unordered_map {
// TODO(#106635): replace with _LIBCPP_CHECK_CONTAINER_VALUE_TYPE_REQUIREMENTS
// Remember to remove relevant headers when this is completed.
static_assert(!is_reference<_Key>::value, "'std::unordered_map' cannot hold references");
static_assert(!is_function<_Key>::value && !is_function<_Tp>::value, "'std::unordered_map' cannot hold functions");
static_assert(!is_void<_Key>::value && !is_void<_Tp>::value, "'std::unordered_map' cannot hold 'void'");
Expand Down Expand Up @@ -1841,6 +1843,8 @@ template <class _Key,
class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_TEMPLATE_VIS unordered_multimap {
// TODO(#106635): replace with _LIBCPP_CHECK_CONTAINER_VALUE_TYPE_REQUIREMENTS
// Remember to remove relevant headers when this is completed.
static_assert(!is_reference<_Key>::value, "'std::unordered_multimap' cannot hold references");
static_assert(!is_function<_Key>::value && !is_function<_Tp>::value,
"'std::unordered_multimap' cannot hold functions");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,21 @@

#include <map>

std::map<int const, int> K1; // not an error
std::map<int, int const> M1; // not an error
std::map<int const, int> K1;
std::map<int, int const> M1;
// TODO(#106635): turn this into a compile-time error

std::map<int volatile, int> K2; // not an error
std::map<int, int volatile> M2; // not an error
std::map<int volatile, int> K2;
std::map<int, int volatile> M2;
// TODO(#106635): turn this into a compile-time error

std::map<int&, int> K3;
// expected-error@*:* {{'std::map' cannot hold references}}
std::map<int, int&> M3; // not an error
std::map<int, int&> M3; // TODO(#106635): turn this into a compile-time error
// expected-error@*:* 1 {{'std::map' cannot hold references}}

std::map<int&&, int> K4; // not an error
std::map<int, int&&> M4; // not an error
std::map<int&&, int> K4;
std::map<int, int&&> M4;
// TODO(#106635): turn this into a compile-time error

std::map<int(), int> K5;
std::map<int(int), int> K6;
Expand All @@ -36,8 +39,9 @@ std::map<int, void> M8;
// expected-error@*:* 2 {{'std::map' cannot hold 'void'}}

std::map<int[], int> K9;
std::map<int, int[]> M9; // TODO(#106635): turn this into a compile-time error
// expected-error@*:*{{'std::map' cannot hold C arrays of an unknown size}}
std::map<int, int[]> M9; // not an error

std::map<int[2], int> K10; // not an error
std::map<int, int[2]> M10; // not an error
std::map<int[2], int> K10;
std::map<int, int[2]> M10;
// TODO(#106635): turn this into a compile-time error
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,21 @@

#include <map>

std::multimap<int const, int> K1; // not an error
std::multimap<int, int const> M1; // not an error
std::multimap<int const, int> K1;
std::multimap<int, int const> M1;
// TODO(#106635): turn this into a compile-time error

std::multimap<int volatile, int> K2; // not an error
std::multimap<int, int volatile> M2; // not an error
std::multimap<int volatile, int> K2;
std::multimap<int, int volatile> M2;
// TODO(#106635): turn this into a compile-time error

std::multimap<int&, int> K3;
// expected-error@*:* {{'std::multimap' cannot hold references}}
std::multimap<int, int&> M3; // not an error
std::multimap<int, int&> M3; // TODO(#106635): turn this into a compile-time error
// expected-error@*:* 1 {{'std::multimap' cannot hold references}}

std::multimap<int&&, int> K4; // not an error
std::multimap<int, int&&> M4; // not an error
std::multimap<int&&, int> K4;
std::multimap<int, int&&> M4;
// TODO(#106635): turn this into a compile-time error

std::multimap<int(), int> K5;
std::multimap<int(int), int> K6;
Expand All @@ -36,8 +39,9 @@ std::multimap<int, void> M8;
// expected-error@*:* 2 {{'std::multimap' cannot hold 'void'}}

std::multimap<int[], int> K9;
std::multimap<int, int[]> M9; // TODO(#106635): turn this into a compile-time error
// expected-error@*:*{{'std::multimap' cannot hold C arrays of an unknown size}}
std::multimap<int, int[]> M9; // not an error

std::multimap<int[2], int> K10; // not an error
std::multimap<int, int[2]> M10; // not an error
std::multimap<int[2], int> K10;
std::multimap<int, int[2]> M10;
// TODO(#106635): turn this into a compile-time error
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,21 @@ struct hash<S volatile> {
};
} // namespace std

std::unordered_map<S const, int> K1; // not an error
std::unordered_map<int, int const> M1; // not an error
std::unordered_map<S const, int> K1;
std::unordered_map<int, int const> M1;
// TODO(#106635): turn this into a compile-time error

std::unordered_map<S volatile, int> K2; // not an error
std::unordered_map<int, int volatile> M2; // not an error
std::unordered_map<S volatile, int> K2;
std::unordered_map<int, int volatile> M2;
// TODO(#106635): turn this into a compile-time error

std::unordered_map<int&, int> K3;
// expected-error@*:* {{'std::unordered_map' cannot hold references}}
std::unordered_map<int, int&> M3; // not an error
std::unordered_map<int, int&> M3; // TODO(#106635): turn this into a compile-time error
// expected-error@*:* 1 {{'std::unordered_map' cannot hold references}}

std::unordered_map<int&&, int> K4;
std::unordered_map<int, int&&> M4; // TODO(#106635): turn this into a compile-time error
// expected-error@*:*{{'std::unordered_map' cannot hold references}}
std::unordered_map<int, int&&> M4; // not an error

std::unordered_map<int(), int> K5;
std::unordered_map<int(int), int> K6;
Expand All @@ -65,9 +67,9 @@ std::unordered_map<int, void> M8;
// expected-error@*:* 2 {{'std::unordered_map' cannot hold 'void'}}

std::unordered_map<int[], int> K9;
std::unordered_map<int, int[]> M9; // TODO(#106635): turn this into a compile-time error
// expected-error@*:*{{'std::unordered_map' cannot hold C arrays of an unknown size}}
std::unordered_map<int, int[]> M9; // not an error

std::unordered_map<int[2], int> K10;
std::unordered_map<int, int[2]> M10; // TODO(#106635): turn this into a compile-time error
// expected-error@*:*{{'std::unordered_map' cannot hold C arrays before C++20}}
std::unordered_map<int, int[2]> M10; // not an error
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,21 @@ struct hash<S volatile> {
};
} // namespace std

std::unordered_multimap<S const, int> K1; // not an error
std::unordered_multimap<int, int const> M1; // not an error
std::unordered_multimap<S const, int> K1;
std::unordered_multimap<int, int const> M1;
// TODO(#106635): turn this into a compile-time error

std::unordered_multimap<S volatile, int> K2; // not an error
std::unordered_multimap<int, int volatile> M2; // not an error
std::unordered_multimap<S volatile, int> K2;
std::unordered_multimap<int, int volatile> M2;
// TODO(#106635): turn this into a compile-time error

std::unordered_multimap<int&, int> K3;
// expected-error@*:*{{'std::unordered_multimap' cannot hold references}}
std::unordered_multimap<int, int&> M3; // not an error
std::unordered_multimap<int, int&> M3; // TODO(#106635): turn this into a compile-time error
// expected-error@*:* 1 {{'std::unordered_multimap' cannot hold references}}

std::unordered_multimap<int&&, int> K4;
std::unordered_multimap<int, int&&> M4; // TODO(#106635): turn this into a compile-time error
// expected-error@*:*{{'std::unordered_multimap' cannot hold references}}
std::unordered_multimap<int, int&&> M4; // not an error

std::unordered_multimap<int(), int> K5;
std::unordered_multimap<int(int), int> K6;
Expand All @@ -60,9 +62,9 @@ std::unordered_multimap<int, void> M8;
// expected-error@*:* 2 {{'std::unordered_multimap' cannot hold 'void'}}

std::unordered_multimap<int[], int> K9;
std::unordered_multimap<int, int[]> M9; // TODO(#106635): turn this into a compile-time error
// expected-error@*:*{{'std::unordered_multimap' cannot hold C arrays of an unknown size}}
std::unordered_multimap<int, int[]> M9; // not an error

std::unordered_multimap<int[2], int> K10;
std::unordered_multimap<int, int[2]> M10; // TODO(#106635): turn this into a compile-time error
// expected-error@*:*{{'std::unordered_multimap' cannot hold C arrays before C++20}}
std::unordered_multimap<int, int[2]> M10; // not an error

0 comments on commit 33a452d

Please sign in to comment.