summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/diagnostics/syserr
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2016-11-14 18:22:19 +0000
committerMarshall Clow <mclow.lists@gmail.com>2016-11-14 18:22:19 +0000
commit1c7fe126ee16857243738ebc1dbaea69caffefb1 (patch)
tree9ccb4a534b61893d510b4ab870a93892479b92a6 /libcxx/test/std/diagnostics/syserr
parentccf2fa1cb64f8b292cfbe964905c4a802fb6dd87 (diff)
downloadbcm5719-llvm-1c7fe126ee16857243738ebc1dbaea69caffefb1.tar.gz
bcm5719-llvm-1c7fe126ee16857243738ebc1dbaea69caffefb1.zip
Fixes for LWG 2598, 2686, 2739, 2742, 2747, and 2759, which were adopted last week in Issaquah
llvm-svn: 286858
Diffstat (limited to 'libcxx/test/std/diagnostics/syserr')
-rw-r--r--libcxx/test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/libcxx/test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp
new file mode 100644
index 00000000000..eb3c06f2ed0
--- /dev/null
+++ b/libcxx/test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template <class T>
+// struct hash
+// : public unary_function<T, size_t>
+// {
+// size_t operator()(T val) const;
+// };
+
+#include <system_error>
+#include <cassert>
+#include <type_traits>
+
+#include "test_macros.h"
+
+void
+test(int i)
+{
+ typedef std::error_condition T;
+ typedef std::hash<T> H;
+ static_assert((std::is_same<H::argument_type, T>::value), "" );
+ static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
+ H h;
+ T ec(i, std::system_category());
+ const std::size_t result = h(ec);
+ LIBCPP_ASSERT(result == i);
+ ((void)result); // Prevent unused warning
+}
+
+int main()
+{
+ test(0);
+ test(2);
+ test(10);
+}
OpenPOWER on IntegriCloud