summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities/utility
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2015-07-28 07:31:50 +0000
committerEric Fiselier <eric@efcs.ca>2015-07-28 07:31:50 +0000
commitabd52cad847e56575e6692e7f43a76e510e67b7e (patch)
treefecc8aa7a2c19766b1110f814b7254f772dcd664 /libcxx/test/std/utilities/utility
parent47a7b95b1da244db1ae9b6217c17917ccca4701a (diff)
downloadbcm5719-llvm-abd52cad847e56575e6692e7f43a76e510e67b7e.tar.gz
bcm5719-llvm-abd52cad847e56575e6692e7f43a76e510e67b7e.zip
Fix a handful of tests that fail in C++03
llvm-svn: 243392
Diffstat (limited to 'libcxx/test/std/utilities/utility')
-rw-r--r--libcxx/test/std/utilities/utility/declval/declval.pass.cpp6
-rw-r--r--libcxx/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp15
2 files changed, 12 insertions, 9 deletions
diff --git a/libcxx/test/std/utilities/utility/declval/declval.pass.cpp b/libcxx/test/std/utilities/utility/declval/declval.pass.cpp
index 81f4df8e8b2..aabd0e6f6c7 100644
--- a/libcxx/test/std/utilities/utility/declval/declval.pass.cpp
+++ b/libcxx/test/std/utilities/utility/declval/declval.pass.cpp
@@ -14,6 +14,8 @@
#include <utility>
#include <type_traits>
+#include "test_macros.h"
+
class A
{
A(const A&);
@@ -22,9 +24,9 @@ class A
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
static_assert((std::is_same<decltype(std::declval<A>()), A&&>::value), "");
#else
- static_assert((std::is_same<decltype(std::declval<A>()), A>::value), "");
+ static_assert((std::is_same<decltype(std::declval<A>()), A&>::value), "");
#endif
}
diff --git a/libcxx/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp b/libcxx/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp
index c8375e9d723..bc60d3d2761 100644
--- a/libcxx/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp
+++ b/libcxx/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp
@@ -56,13 +56,14 @@ int main()
static_assert((std::is_same<decltype(std::move_if_noexcept(ca)), const A&&>::value), "");
static_assert((std::is_same<decltype(std::move_if_noexcept(l)), const legacy&>::value), "");
#else // C++ < 11
- // libc++ defines decltype to be __typeof__ in C++03. __typeof__ does not
- // deduce the reference qualifiers.
- static_assert((std::is_same<decltype(std::move_if_noexcept(i)), const int>::value), "");
- static_assert((std::is_same<decltype(std::move_if_noexcept(ci)), const int>::value), "");
- static_assert((std::is_same<decltype(std::move_if_noexcept(a)), const A>::value), "");
- static_assert((std::is_same<decltype(std::move_if_noexcept(ca)), const A>::value), "");
- static_assert((std::is_same<decltype(std::move_if_noexcept(l)), const legacy>::value), "");
+ // In C++03 libc++ #define's decltype to be __decltype on clang and
+ // __typeof__ for other compilers. __typeof__ does not deduce the reference
+ // qualifiers and will cause this test to fail.
+ static_assert((std::is_same<decltype(std::move_if_noexcept(i)), const int&>::value), "");
+ static_assert((std::is_same<decltype(std::move_if_noexcept(ci)), const int&>::value), "");
+ static_assert((std::is_same<decltype(std::move_if_noexcept(a)), const A&>::value), "");
+ static_assert((std::is_same<decltype(std::move_if_noexcept(ca)), const A&>::value), "");
+ static_assert((std::is_same<decltype(std::move_if_noexcept(l)), const legacy&>::value), "");
#endif
#if TEST_STD_VER > 11
OpenPOWER on IntegriCloud