summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/containers/sequences/array/array.data/data_const.pass.cpp
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2017-01-04 17:58:17 +0000
committerMarshall Clow <mclow.lists@gmail.com>2017-01-04 17:58:17 +0000
commit020b623a3b03a89aa56beba357bfa27c36cf13a7 (patch)
tree524e8201eb9d25861affd059a55f1123ec75d943 /libcxx/test/std/containers/sequences/array/array.data/data_const.pass.cpp
parentdf8a13b25763b7192579c74049322e5e6dd3da54 (diff)
downloadbcm5719-llvm-020b623a3b03a89aa56beba357bfa27c36cf13a7.tar.gz
bcm5719-llvm-020b623a3b03a89aa56beba357bfa27c36cf13a7.zip
Implement the last bit of P0031: 'A Proposal to Add Constexpr Modifiers to reverse_iterator, move_iterator, array and Range Access' for C++17
llvm-svn: 290976
Diffstat (limited to 'libcxx/test/std/containers/sequences/array/array.data/data_const.pass.cpp')
-rw-r--r--libcxx/test/std/containers/sequences/array/array.data/data_const.pass.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/libcxx/test/std/containers/sequences/array/array.data/data_const.pass.cpp b/libcxx/test/std/containers/sequences/array/array.data/data_const.pass.cpp
index 58840e94089..5be082eeb84 100644
--- a/libcxx/test/std/containers/sequences/array/array.data/data_const.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.data/data_const.pass.cpp
@@ -14,6 +14,8 @@
#include <array>
#include <cassert>
+#include "test_macros.h"
+
// std::array is explicitly allowed to be initialized with A a = { init-list };.
// Disable the missing braces warning for this reason.
#include "disable_missing_braces_warning.h"
@@ -36,4 +38,16 @@ int main()
const T* p = c.data();
(void)p; // to placate scan-build
}
+#if TEST_STD_VER > 14
+ {
+ typedef std::array<int, 5> C;
+ constexpr C c1{0,1,2,3,4};
+ constexpr const C c2{0,1,2,3,4};
+
+ static_assert ( c1.data() == &c1[0], "");
+ static_assert ( *c1.data() == c1[0], "");
+ static_assert ( c2.data() == &c2[0], "");
+ static_assert ( *c2.data() == c2[0], "");
+ }
+#endif
}
OpenPOWER on IntegriCloud