mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-23 10:07:41 +08:00
Implement the last bit of P0031: 'A Proposal to Add Constexpr Modifiers to reverse_iterator, move_iterator, array and Range Access' for C++17
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290976 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user