summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/containers/sequences/array/array.tuple
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2015-07-18 23:56:04 +0000
committerEric Fiselier <eric@efcs.ca>2015-07-18 23:56:04 +0000
commit2decfad7c5df07030c27e70b98ca9feada760d3c (patch)
treedf23e04f441d63a82cf185fce9334e6489560caf /libcxx/test/std/containers/sequences/array/array.tuple
parent818139da5909af767e7579b819876e67149e9d9a (diff)
downloadbcm5719-llvm-2decfad7c5df07030c27e70b98ca9feada760d3c.tar.gz
bcm5719-llvm-2decfad7c5df07030c27e70b98ca9feada760d3c.zip
Fix warnings in array and assoc containers
llvm-svn: 242629
Diffstat (limited to 'libcxx/test/std/containers/sequences/array/array.tuple')
-rw-r--r--libcxx/test/std/containers/sequences/array/array.tuple/get.fail.cpp9
-rw-r--r--libcxx/test/std/containers/sequences/array/array.tuple/get.pass.cpp11
-rw-r--r--libcxx/test/std/containers/sequences/array/array.tuple/get_const.pass.cpp6
-rw-r--r--libcxx/test/std/containers/sequences/array/array.tuple/get_rv.pass.cpp7
4 files changed, 26 insertions, 7 deletions
diff --git a/libcxx/test/std/containers/sequences/array/array.tuple/get.fail.cpp b/libcxx/test/std/containers/sequences/array/array.tuple/get.fail.cpp
index 4f4fbcf93af..ae629bd4daa 100644
--- a/libcxx/test/std/containers/sequences/array/array.tuple/get.fail.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.tuple/get.fail.cpp
@@ -11,15 +11,22 @@
// template <size_t I, class T, size_t N> T& get(array<T, N>& a);
+// Prevent -Warray-bounds from issuing a diagnostic when testing with clang verify.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Warray-bounds"
+#endif
+
#include <array>
#include <cassert>
+#include "../suppress_array_warnings.h"
+
int main()
{
{
typedef double T;
typedef std::array<T, 3> C;
C c = {1, 2, 3.5};
- std::get<3>(c) = 5.5; // Can't get element 3!
+ std::get<3>(c) = 5.5; // expected-error@array:* {{static_assert failed "Index out of bounds in std::get<> (std::array)"}}
}
}
diff --git a/libcxx/test/std/containers/sequences/array/array.tuple/get.pass.cpp b/libcxx/test/std/containers/sequences/array/array.tuple/get.pass.cpp
index d9e242cd420..c4557078fc4 100644
--- a/libcxx/test/std/containers/sequences/array/array.tuple/get.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.tuple/get.pass.cpp
@@ -14,12 +14,17 @@
#include <array>
#include <cassert>
-#if __cplusplus > 201103L
+#include "test_macros.h"
+
+#include "../suppress_array_warnings.h"
+
+
+#if TEST_STD_VER > 11
struct S {
std::array<int, 3> a;
int k;
constexpr S() : a{1,2,3}, k(std::get<2>(a)) {}
- };
+};
constexpr std::array<int, 2> getArr () { return { 3, 4 }; }
#endif
@@ -35,7 +40,7 @@ int main()
assert(c[1] == 5.5);
assert(c[2] == 3.5);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef double T;
typedef std::array<T, 3> C;
diff --git a/libcxx/test/std/containers/sequences/array/array.tuple/get_const.pass.cpp b/libcxx/test/std/containers/sequences/array/array.tuple/get_const.pass.cpp
index 1cbdfa4ff39..ddc2ab2855c 100644
--- a/libcxx/test/std/containers/sequences/array/array.tuple/get_const.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.tuple/get_const.pass.cpp
@@ -14,6 +14,10 @@
#include <array>
#include <cassert>
+#include "test_macros.h"
+
+#include "../suppress_array_warnings.h"
+
int main()
{
{
@@ -24,7 +28,7 @@ int main()
assert(std::get<1>(c) == 2);
assert(std::get<2>(c) == 3.5);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef double T;
typedef std::array<T, 3> C;
diff --git a/libcxx/test/std/containers/sequences/array/array.tuple/get_rv.pass.cpp b/libcxx/test/std/containers/sequences/array/array.tuple/get_rv.pass.cpp
index 8eec3ceff51..412c7c78aa8 100644
--- a/libcxx/test/std/containers/sequences/array/array.tuple/get_rv.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.tuple/get_rv.pass.cpp
@@ -11,14 +11,18 @@
// template <size_t I, class T, size_t N> T&& get(array<T, N>&& a);
+// UNSUPPORTED: c++98, c++03
+
#include <array>
#include <memory>
#include <utility>
#include <cassert>
+#include "../suppress_array_warnings.h"
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
{
typedef std::unique_ptr<double> T;
typedef std::array<T, 1> C;
@@ -26,5 +30,4 @@ int main()
T t = std::get<0>(std::move(c));
assert(*t == 3.5);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
OpenPOWER on IntegriCloud