diff options
author | Billy Robert O'Neal III <bion@microsoft.com> | 2017-04-06 23:50:21 +0000 |
---|---|---|
committer | Billy Robert O'Neal III <bion@microsoft.com> | 2017-04-06 23:50:21 +0000 |
commit | eaeeaaf375c8824f641c0f02ed90582be73fc6ac (patch) | |
tree | 8f1133ce180f8c27f6256d1e005388604a8c6261 /libcxx/test/std/utilities/optional/optional.hash/hash.pass.cpp | |
parent | 10169b6d0daa53b741a779909bfe241783aff22e (diff) | |
download | bcm5719-llvm-eaeeaaf375c8824f641c0f02ed90582be73fc6ac.tar.gz bcm5719-llvm-eaeeaaf375c8824f641c0f02ed90582be73fc6ac.zip |
Allow a standard library to implement conditional noexcept for optional and unique_ptr hash functions.
These tests were unconditionally asserting that optional and unique_ptr declare throwing hashes, but MSVC++ implements conditional noexcept forwarding that of the underlying hash function. As a result we were failing these tests but there's nothing forbidding strengthening noexcept in that way.
Changed the ASSERT_NOT_NOEXCEPT asserts to use types which themselves have non-noexcept hash functions.
llvm-svn: 299734
Diffstat (limited to 'libcxx/test/std/utilities/optional/optional.hash/hash.pass.cpp')
-rw-r--r-- | libcxx/test/std/utilities/optional/optional.hash/hash.pass.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libcxx/test/std/utilities/optional/optional.hash/hash.pass.cpp b/libcxx/test/std/utilities/optional/optional.hash/hash.pass.cpp index 1e40881907b..6d9a2607d14 100644 --- a/libcxx/test/std/utilities/optional/optional.hash/hash.pass.cpp +++ b/libcxx/test/std/utilities/optional/optional.hash/hash.pass.cpp @@ -38,9 +38,14 @@ int main() std::hash<optional<double>>{}(optional<double>{}); { + optional<B> opt; + ASSERT_NOT_NOEXCEPT(std::hash<optional<B>>()(opt)); + ASSERT_NOT_NOEXCEPT(std::hash<optional<const B>>()(opt)); + } + + { typedef int T; optional<T> opt; - ASSERT_NOT_NOEXCEPT(std::hash<optional<T>>()(opt)); assert(std::hash<optional<T>>{}(opt) == nullopt_hash); opt = 2; assert(std::hash<optional<T>>{}(opt) == std::hash<T>{}(*opt)); @@ -48,7 +53,6 @@ int main() { typedef std::string T; optional<T> opt; - ASSERT_NOT_NOEXCEPT(std::hash<optional<T>>()(opt)); assert(std::hash<optional<T>>{}(opt) == nullopt_hash); opt = std::string("123"); assert(std::hash<optional<T>>{}(opt) == std::hash<T>{}(*opt)); @@ -56,7 +60,6 @@ int main() { typedef std::unique_ptr<int> T; optional<T> opt; - ASSERT_NOT_NOEXCEPT(std::hash<optional<T>>()(opt)); assert(std::hash<optional<T>>{}(opt) == nullopt_hash); opt = std::unique_ptr<int>(new int(3)); assert(std::hash<optional<T>>{}(opt) == std::hash<T>{}(*opt)); |