diff options
| author | Louis Dionne <ldionne@apple.com> | 2018-12-06 21:46:17 +0000 |
|---|---|---|
| committer | Louis Dionne <ldionne@apple.com> | 2018-12-06 21:46:17 +0000 |
| commit | 3560fbf3049045bf2ac3f3ecb1ddeb73cbe946cf (patch) | |
| tree | e7c0b1ff885767ec43d44cf846c4ddb3650caa6c /libcxx/include/unordered_set | |
| parent | 037ed1befd3ae2677cb09af72214420e80344f0a (diff) | |
| download | bcm5719-llvm-3560fbf3049045bf2ac3f3ecb1ddeb73cbe946cf.tar.gz bcm5719-llvm-3560fbf3049045bf2ac3f3ecb1ddeb73cbe946cf.zip | |
[libc++] Improve diagnostics for non-const comparators and hashers in associative containers
Summary:
When providing a non-const-callable comparator in a map or set, the
warning diagnostic does not include the point of instantiation of
the container that triggered the warning, which makes it difficult
to track down the problem. This commit improves the diagnostic by
placing it directly in the body of the associative container.
The same change is applied to unordered associative containers, which
had a similar problem.
Finally, this commit cleans up the forward declarations of several
map and unordered_map helpers, which are not needed anymore.
<rdar://problem/41370747>
Reviewers: EricWF, mclow.lists
Subscribers: christof, dexonsmith, llvm-commits
Differential Revision: https://reviews.llvm.org/D48955
llvm-svn: 348529
Diffstat (limited to 'libcxx/include/unordered_set')
| -rw-r--r-- | libcxx/include/unordered_set | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set index de23ca2a396..25b92203f25 100644 --- a/libcxx/include/unordered_set +++ b/libcxx/include/unordered_set @@ -384,6 +384,7 @@ public: typedef const value_type& const_reference; static_assert((is_same<value_type, typename allocator_type::value_type>::value), "Invalid allocator::value_type"); + static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); private: typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table; @@ -976,6 +977,7 @@ public: typedef const value_type& const_reference; static_assert((is_same<value_type, typename allocator_type::value_type>::value), "Invalid allocator::value_type"); + static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); private: typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table; |

