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/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/set')
| -rw-r--r-- | libcxx/include/set | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libcxx/include/set b/libcxx/include/set index ccf785ab1b0..fb15ecfa021 100644 --- a/libcxx/include/set +++ b/libcxx/include/set @@ -445,6 +445,7 @@ public: typedef value_type& reference; typedef const value_type& const_reference; + static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); static_assert((is_same<typename allocator_type::value_type, value_type>::value), "Allocator::value_type must be same type as value_type"); @@ -925,6 +926,7 @@ public: typedef value_type& reference; typedef const value_type& const_reference; + static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); static_assert((is_same<typename allocator_type::value_type, value_type>::value), "Allocator::value_type must be same type as value_type"); |

